Reputation: 348
I'm trying to query into following document and want to list all document which contains TaxonomyID "1" in "TaxonomyIDs" field.
...
"Slug" : "videosecu-600tvl-outdoor-security-surveillance",
"Category" : "Digital Cameras",
"SubCategory" : "Surveillance Cameras",
"Segment" : "",
"Usabilities" : [
"Dome Cameras",
"Night Vision"
],
"TaxonomyIDs" : [
1,
12,
20,
21,
13
],
"Brand" : "VideoSecu",
...
Totally stuck!
Upvotes: 0
Views: 6184
Reputation: 146034
Model.find({TaxonomyIDs: 1}, function(error, models) {
//put code to process the results here
});
mongodb interprets the query conditions above as "match any document where the TaxonomyIDs array contains 1".
Upvotes: 7