mongo中删除filed不存在的document
来源:互联网 发布:人工智能可以思考吗 编辑:程序博客网 时间:2024/06/01 23:39
This will return all documents with a key called "IMAGE URL", but they may still have a null value.
db.mycollection.find({"IMAGE URL":{$exists:true}});
This will return all documents with both a key called "IMAGE URL" and a non-null value.
db.mycollection.find({"IMAGE URL":{$ne:null}});
Also, according to the docs, $exists currently can't use an index, but $ne can.
Edit: Adding some examples due to interest in this answer
Given these inserts:
db.test.insert({"num":1, "check":"check value"});db.test.insert({"num":2, "check":null});db.test.insert({"num":3});
This will return all three documents:
db.test.find();
This will return the first and second documents only:
db.test.find({"check":{$exists:true}});
This will return the first document only:
db.test.find({"check":{$ne:null}});
This will return the second and third documents only:
db.test.find({"check":null})
0 0
- mongo中删除filed不存在的document
- V4L2中filed的理解
- 删除Oracle中不存在的服务
- 怎样删除数据字典中不存在的表信息
- MySQL----删除B表中A表不存在的记录
- 删除git branch -a 中不存在的远程分支
- Solr的Filed中indexed与stored属性
- 删除不存在的服务名称
- 删除不存在的远程分支
- 《JavaScript高级编程》,removeChild()后,节点不存在于document中
- mongo对多个document操作事务的解决方案
- Filed
- Filed
- 关于MongoDB中如何做到对已有数据插入时更新字段,不存在时则插入新的Document
- git技巧:删除在本地的但在远程库中已经不存在的分支
- 添加/删除Windows组件中不存在IIS信息服务时的IIS的安装
- 如何彻底删除已经不存在的数据文件?
- mybatis批量删除、插入不存在的数据
- 用keytool创建Keystore和Trustsotre文件
- 信息
- IOS数据库操作SQLite3使用详解
- SQL注入(PreparedStatement)
- 应知道的数据库连接池DBCP配置及JDBC超时设置
- mongo中删除filed不存在的document
- 冒泡
- 如何把PDF文件内容转换成TXT
- 华为C语言编程规范—排版
- 登陆界面
- IPC网络高清摄像机基础知识5(经典YUV格式详解)
- 16进制
- iOS 布尔值转换中文 以及布尔值的打印
- 第三部分 linux busybox最小文件系统的移植