How can I query for multiple documents using their _id
i.e., if i have an array of ids of documents in a certain collection, how can i get all of these documents at once in a single operation
can i use something like:
db.collection.find({_id:[id1,id2,id3]})
and then mongodb return 3 documents of ids id1,id2,id3
is that possible, and if so, what is the exact syntax , or method , and is there any advices or precautions to take into consideration?
Just use
$inoperator as MongoDB doc says: