I have a MongoDB document structure like this:
{
"name": "list"
"config": "default"
"items": [
{
"email": "[email protected]"
"status": true
"number": 123
},
...
{
"email": "[email protected]"
"status": false
"number": 432
},
]
}
Now, how can I retrive multiple subdocuments that much certain criteria. For instance, I want to obtain all documents where status = true. I know that it is possible to use $elemMatch, but it returns only the first matching instance and I need ALL documents that correspond to the specified condition. Please show how can it be done with Java.