title: MongoDB - using $nin on another field
body: <p>I am using MongoDB 2.6.7 and I am trying to run the following query</p>
  
  <pre><code>Categories.find({'_id': { $nin: ancestors }})
  </code></pre>
  
  <p>Where the Categories collection is exactly like that used in MongoDB docs manual (model tree structures with ancestors array). Ex:</p>
  
  <pre><code>db.categories.insert( { _id: "MongoDB", ancestors: [ "Books", "Programming", "Databases" ], parent: "Databases" } )
  </code></pre>
  
  <p>but I am not getting any results, so I was wondering if it is possible to get all documents in the Categories collection which are not included in the ancestors array field of any document... in other words Categories that have no child categories.</p>