Currently I could filter with this MongoDb query
db.getCollection("entity").find( { "NameDetails.Name.0.NameValue.0.EntityName" : /ABC/ } );
How do I loop through all the Name and then all the NameValue to search for /ABC/? If any of it matches, it returns as result.
Name
NameValue
You need to either use elemMatch or unwind.
elemMatch
unwind
If you know that it would match one element always, use elemMatch
or
If you want all the matching elements in the array, go for unwind then group.
group
1.4m articles
1.4m replys
5 comments
57.0k users