[英]How to find items in an array that are not contained in a MongoDB collection
[英]How to find all the items that are not numbers in MongoDB collection?
我在mongodb数据库中有一个字段,该字段主要包含数字,但也可能包含一些null,字符串等。 如何找到所有这些记录?
我不确定我是否完全理解您的问题。 您要获取数字还是非数字? 无论如何,您可以通过以下方式之一:
号码:
db.stuff.find({my_field: { $type: 1 }})
其他
db.stuff.find({my_field: { $not: {$type: 1 }}})
在查询对象中使用$type
运算符可以按字段的数据类型进行选择。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.