对于相同的字段名,我有不同的数据类型 f
f
具有 this 参考
我想找到所有不是 Double 而不是 NULL
Double
NULL
我能找到那些不是 双重的 通过
双重的
db.foo.find({ f:{$not:{$type:1}} })
但不能将查询与not组合 无效的
无效的
尝试使用
db.foo.find({f:{$not:{$and:[{$type:1},{$type:10}]}}})' db.foo.find({$and:[{f:{$not:{$type:1}}}, {f:{$not:{$type:10}}}] })
但那失败了
有什么帮助吗?
你想要的是 $nor 条件
db.foo.find({ $nor:[ { f: {$type:1} }, { f: null }] })
这意味着 没有一个 包含的参数中的是true。也不是查找 null 价值
null