Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I retrieve multiple docs from Mongo by id?

I have an array of ids and I want to retrieve all of them at once. Is this possible, can I pass an array of ids somehow and have all of them returned to me? If so, how?

I'm using the node-native driver.

Thanks!

like image 774
fancy Avatar asked Apr 20 '12 12:04

fancy


1 Answers

you need to use $in operator, that would give you desired result.

https://docs.mongodb.com/manual/reference/operator/query/in/

like image 54
DhruvPathak Avatar answered Oct 04 '22 16:10

DhruvPathak