TaW
0
Q:

mongodb find array with element

db.yourCollection.find( { array: "element" } )
1
db.articles.find({
    "stock.country" : "01",
    "stock.warehouse.code" : "02"
}).pretty();
1
// Finds all documents that have a property named "tags"
// which has at least one array element matching "red"
db.inventory.find( { tags: "red" } )
0
db.inventory.find( { tags: ["red", "blank"] } )
-1

New to Communities?

Join the community