0

我正在尝试查询以下文档,并希望在“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",
...

完全卡住了!

4

1 回答 1

7
Model.find({TaxonomyIDs: 1}, function(error, models) {
  //put code to process the results here
});

mongodb 将上面的查询条件解释为“匹配 TaxonomyIDs 数组包含 1 的任何文档”。

于 2013-10-20T04:29:45.463 回答