http://stackoverflow.com/questions/8303900/mongodb-mongoose-findmany-find-all-documents-with-ids-listed-in-array
Borrowing from a quick google, insert the '$in' clause: find('purchasedItemID': { $in: productId}) On Friday, 6 May 2016 02:43:38 UTC+1, Hemanth kumar wrote: > > I am getting array from angular controller like [ > '572b2e5d63f338b02afa36b9', '572b3da2034e6370301943bc' ] to node. > > Below code is my node > > router.get('/purchaserInfo',function(req,res){ > console.log(req.query.proID); > var productId = req.query.proID; > var findPurchaserInfo = function(db, callback) { > var cursor > =db.collection('purchased').find({purchasedItemID:productId}).toArray(function(err, > > docs){ > if(err){ > callback(new Error("Some problem")); > }else{ > callback(null,docs); > } > }); > }; > MongoClient.connect(url, function(err, db) { > assert.equal(null, err); > findPurchaserInfo(db, function(err,docs) { > db.close(); > if(err) return res.json({result:null}) > else > return res.json({result: docs}); > }); > }); > }); > > > > I want both product id to search but it takes only last one.How to solve > this. > -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. To post to this group, send email to nodejs@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/140217d4-e2ea-4d6d-a91f-c453b6e249ec%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.