我有这样一个集合数据
[
{
items : [
{isTrue : false},
{isTrue : true},
]
},
{
items : [
{isTrue : false},
{isTrue : false},
]
},
{
items : [
{isTrue : true},
{isTrue : false},
]
},
{
items : [
{isTrue : true},
{isTrue : true},
]
},
]
我只想得到没有 isTrue 的项目:true 所以数据计数是1
有人知道吗?
最佳答案
你想要的是$not
运算符(operator)
db.collection.find({'items': { '$not': { '$eq': { isTrue: true }}}})
关于mongodb - 查询不包含在 mongoDB 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40782971/