I am using MongoDB as my DB storage and the query adaption has being nice from SQL to Mongo although I am not understanding quite well how can I achieve simple queries like:
- filter a Document where their Subdocument last item has a field called 'Exit' set to true.
Example:
{
Name: '',
Addresses:
[
{
Street: '',
IsDefault: true/false
},
{
Street: '',
IsDefault: true/false
},
{
Street: '',
IsDefault: true/false
}
]
}
The result should be:
All the persons that have the last Address 'IsDefault' field is set to true, and only those.
I've searched online but it seems hard to find a way to figure this out.
Appreciated if someone can give me an hint.
Thanks