Reputation: 824
So I have an array with some values.
How can I find all documents which contain in a specific field value from array?
For example:
Array : ["1", "2"]
Documents
{field : "1"},
{field : "2"},
{field : "3"}
I need to find:
{field : "1"},
{field : "2"}
Upvotes: 0
Views: 56
Reputation: 1849
can you please try this?
db.inventory.find( { field: { $in: [ "1", "2"] } } )
Upvotes: 2