Answer the question
In order to leave comments, you need to log in
How to do a lookup in a Mongo nested array?
There is a collection 'users' with 1 document
db.users.find() returns ()
{
"_id" : "L7Bo6u6Xy7KyXLvBR",
"username" : "user",
"emails" : [
{
"address" : '[email protected]'
}
]
}
db.users.find({ 'emails':{'address': '[email protected]' }})
Answer the question
In order to leave comments, you need to log in
db.users.find({ 'emails':{ $elemMatch: {'address': '[email protected]'}}})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question