我正在尝试查询以下文档,并希望在“TaxonomyIDs”字段中列出包含TaxonomyID“1”的所有文档。
...
"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",
...
完全卡住了!
答案 0 :(得分:7)
Model.find({TaxonomyIDs: 1}, function(error, models) {
//put code to process the results here
});
mongodb将上面的查询条件解释为“匹配TaxonomyIDs数组包含1的任何文档”。