0

I am aware that mongodb allows $elemMatch, $slice and $ aggregators when it comes into returning fields from query but I'm wondering on how to return these fields that I want to be returned. Here's my data:

{_id:'abc',
 content:[
          {x:1,arr:['123','456'],arr2:[]},
          {x:2,arr:['456','789'],arr2:[]},
          {x:3,arr:['123','678'],arr2:[{y:1,z:1}]},
          {x:4,arr:['123','789'],arr2:[{y:0,z:0}]}
         ]
}

and I want to return all objects that doesn't contain arr:['123'] and arr2:[{y:1,z:1}]

Any kind of help would be appreciated.

hxho2
  • 1
  • When you say _all object that doesn't contain .._ do you mean sub-documents from the array `content` or documents in the collection? – chridam May 11 '15 at 19:22
  • possible duplicate of [How to filter array in subdocument with MongoDB](http://stackoverflow.com/questions/15117030/how-to-filter-array-in-subdocument-with-mongodb) – Sylvain Leroux May 11 '15 at 20:20

0 Answers0