I\'m using Node.js with MongoDB, I\'m also using Monk for db access. I have the below code :
console.time(\"start\"); collection.findOne({name: \"jason\"},
collection.aggregate([ { $match:{ id :{ "$in" : document.friends}, } } ]).exec(function ( e, d ) { console.log( d ) if(!e){ // your code when got data successfully }else{ // your code when you got the error } });