我正在尝试使用Mongodb Query在$ match管道中使用$ in查询运算符查找某些状态的填充。
我尝试运行此代码,但我不断收到错误。我做错了什么?
db.getCollection("statistics").aggregate(
[
{ $match: {"pop": 1}, "state": {$in: ["MN", "IA", "ND", "SD", "WI"]}}
]
);
答案 0 :(得分:0)
将$match
与$and
条件
db.getCollection("statistics").aggregate(
[
{$match: {
$and: [
{"pop" :{ $eq : 1}},
{"state": {$in: ["MN", "IA", "ND", "SD", "WI"]}}
]
}
}
]
);