mongodb - 查找集合中存在且具有非空值或非空值的所有属性
问题描述
我试图在我的集合中使用 Robo3T 查找所有属性InternalCode
不为空且不为空的属性
db.getCollection('db1.customer').find({ InternalCode : { $exists: true, $ne: null } })
这将返回所有具有该属性且设置为非空的文档。
如何处理我想要非空而不是空值的场景?
解决方案
要不为空也不为空,
db.getCollection('db1.customer').find({ InternalCode : { $exists: true, $nin:[null,""] } })
推荐阅读
- discord.js - 如何检查用户是否有角色?
- vue.js - 如何在 vee-validate 中使用自定义消息进行跨字段验证?
- kdb - 在什么情况下表格会被转换成字典?
- flutter - 颤振“请稍候......分钟”功能
- python - 使用 SublimeText REPL 时的语法问题
- python - 使用二维数组来判断玩家在文本游戏中的位置
- powershell - 办公产品的 Powershell Start-Process 不起作用
- sql - 让学生有空闲时间 (SQL)
- github - 无法读取或写入 IntelliJ 中的私有 Github 远程设置存储库
- java - 如何计算java中打印数字的总和