node.js getting documents by id from an array using monk
<p>I'm trying to fetch a few documents from a collection in mongodb with a set of ids</p>

<p>similar to SQLish</p>

<pre><code>SELECT * FROM TABLE WHERE &lt;id&gt; IN [1,3,4]
</code></pre>

<p>Here is the code i'm using:</p>

<pre><code>var prodCollection = req.db.get('products');
      prodCollection.find({'-_id':{'$in':["572446507cd5bb7304d75993","572446507cd5bb7304d75994"]}},{}, function(err, docs){
        if(err) throw err;
        res.send(docs);
      });
</code></pre>

<p>my setup is a node.js server running on local host using express and monk. i've also tried various versions of the same code with or without single quotes for the IN and _id parameters but with no luck, my returned docs array is always empty. I can confirm my database indeed contain the collection and the docs by accessing it from the console :</p>

<pre><code>&gt; db.products.find()
{ "_id" : ObjectId("572446507cd5bb7304d75993"), "name" : "apples", "quantity" : 20, "checked" : false }
{ "_id" : ObjectId("5724466c7cd5bb7304d75994"), "name" : "bananas", "quantity" : 2, "checked" : false }
{ "_id" : ObjectId("5724467e7cd5bb7304d75995"), "name" : "cerial", "quantity" : 10, "checked" : true }
</code></pre>