Reputation: 31
Given a scenario where I have a root document with an array of objects. Is it possible to return a document that contains a set of objects?
For instance:
doc 1
{
"name": "someName"
"date": "someDate"
"anArray" : [
{"key1": "value1", "key2":"value2"},
{"key1": "value3", "key2":"value4"}...]
}
doc 2
{
"name": "someOtherName"
"date": "someOtherDate"
"anArray" : [
{"key1": "value1", "key2":"value2"},
{"key1": "value4", "key2":"value3"}...]
}
I want a query that will match and return Doc1 based on :
documents that contains object in the anArray with key1 = value1 && key 2=value2 AND also has object in the anArray with key1=value3 and key2= value4
Is this possible?
Upvotes: 0
Views: 40
Reputation: 31
Combine multiple nested filters on the outer query to achieve this - as Val suggested.
Upvotes: 0