mongodb remove
来源:互联网 发布:逆战瞬狙数据 编辑:程序博客网 时间:2024/06/06 04:25
db.集合名称.remove({query}, justOne)
query:过滤条件,可选
justOne:是否只删除查询到的第一条数据,值为true或者1时,只删除一条数据,默认为false,可选。删除第一条
> db.student.remove({age:28}, true)WriteResult({ "nRemoved" : 1 })> db.student.find(){ "_id" : 2, "name" : "lisi", "age" : 28 }{ "_id" : 3, "name" : "wangwu", "age" : 30 }{ "_id" : 4, "name" : "zhaoliu", "age" : 28 }{ "_id" : 5, "name" : "qianliu", "age" : 33 }{ "_id" : 6, "name" : "sunba", "age" : 32 }{ "_id" : 7, "name" : "songjiu", "skill" : [ "mongodb", "java" ] }
删除所有的数据
> db.student.remove({age:28})WriteResult({ "nRemoved" : 2 })> db.student.find(){ "_id" : 3, "name" : "wangwu", "age" : 30 }{ "_id" : 5, "name" : "qianliu", "age" : 33 }{ "_id" : 6, "name" : "sunba", "age" : 32 }{ "_id" : 7, "name" : "songjiu", "skill" : [ "mongodb", "java" ] }
删除集合所有{}
> db.student.remove({})WriteResult({ "nRemoved" : 4 })
1 0
- mongodb remove
- mongodb-基础-update-remove
- MongoDB 操作手册CRUD 删除 remove
- mongodb db.collection.remove用法
- MongoDB小结03 - insert、remove
- Mongodb中回收remove的磁盘空间
- MongoDB学习日记(七):CRUD - remove
- mongodb中的remove和drop的区别
- 【mongoDB 操作】--update, remove, $set, $push
- mongodb中的remove和drop的区别
- php + mongodb 百万级记录批量remove异常问题
- mongoDB remove和drop操作的时间性能
- MongoDB Remove函数的3个常见用法
- Spring Boot MongoDB How to remove _class from spring data mongodb collection
- remove
- remove
- remove
- remove
- MIT计算机科学集编程导论(一)
- html5 video 视频标签详解
- C++_Primer_chapter17 2.命名空间
- Kinect尝鲜(1)——第一个程序
- linux ifcfg-eth0文件配置静态ip(centos-6.5)
- mongodb remove
- hdu 5877 离散化+树状数组+dfs序
- 375.Clone Binary Tree-克隆二叉树(容易题)
- boost 安装
- 数据库索引的作用优点和缺点
- Java中函数参数的传递是值传递还是引用传递
- 12章 5题
- Spark入门的WordCount
- 12章 1.判断春夏秋冬