MongoDB return documents where the id is within an array of ids


How would I query a collection and return only the documents where the id is within an array.

I have an admin panel where I have a multi select box which contains ids from a specific collection.
On the homepage based on the selected posts I want the ids that are within that array to be the only documents returned to the homepage.

I’ve seen examples for $in however this only seems to return one document.

Hi, may be :
return Items.find({_id : {$in : ids}});
//home page (client script):
var ids = …
//subcribe getFilterItems with param : ids
//find again
var items = Items.find({_id : {$in : ids}});

Thank you for the solution. I will give this a shot.