Hello,
I have this sample entry:
{
"_id" : ObjectId("5035648bc2ce90bf9272d022"),
"testMap" : {
"a" : {
"testArray" : [1, 1, 2, 2, 3, 4]
},
"b" : {
"testArray" : [1, 2, 3, 4, 5, 6]
}
}
}
So my goal is to find a particular number in a particular node, but it can't have the complete 6 numbers. For example, this should return the record above:
db.testColl.findOne(
{$and:
[
{"testMap.a.testArray":1},
{"testMap.a.testArray":{$not:{$all:[1,2,3,4,5,6]}}}
]}
);
However, this should return nothing:
db.testColl.findOne(
{$and:
[
{"testMap.b.testArray":1},
{"testMap.b.testArray":{$not:{$all:[1,2,3,4,5,6]}}}
]}
);
Can someone help me with this? If not, how do I manually write this query, but parse the result to an object?
Thanks,
Rick