![](/img/trans.png)
[英]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.