mongodb查询null
2022/5/10 19:04:07
本文主要是介绍mongodb查询null,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
db.inventory.insertMany([ { _id: 1, item: null }, { _id: 2 }, { _id: 3, item: 1} ])
这三条数据的item字段,分别为null,不存在,为数字1。
db.inventory.find({item:null}),该{ item : null }查询匹配包含item其值为null 或不包含该item字段的字段的文档。
db.inventory.find( { item : { $type: 10 } } ),只查询出item为null的文档。
db.inventory.find( { item : { $exists: false } } ),只查询出item缺失的文档。
db.inventory.find( { item : { $exists: true } } ),只查询出item存在的文档,包括item为null的文档。
这篇关于mongodb查询null的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-04-01got an unexpected keyword argument
- 2024-03-30维多利亚的秘密 golang入坑系统
- 2024-03-29mongodb sort by date
- 2024-03-29go swagger
- 2024-03-25mongodb cdc
- 2024-03-25how to use go in vscode
- 2024-03-22mongooseserverselectionerror: connect econnrefused ::1:27017
- 2024-03-21pymongo insert_many
- 2024-03-18projection mongodb
- 2024-03-14clickhouse-go