5.MongoDB CRUD Operations-官方文档摘录
总结
1. CRUD:create, read, update, and delete DOCUMENT
2.在3.2版本的插入方式
db.collection.insertOne()
db.collection.insertMany()
db.users.insertOne(
{
name:"sue",
age:26,
status:"pending"
}
)
3 Read 操作
db.users.find(
{
age:{$gt:18},
name:1,address:1
}
)
4 Update操作
db.collection.updateOne()
db.collection.updatMany()
db.collection.replaceOne()
db.users.find(
{
age:{$gt:18},
name:1,address:1
}
)
5 Delete操作
db.users.deleteOne()
db.users.deleteMany()
CRUD operations create, read, update, and delete documents.
Create Operations
Create or insert operations add new documents to a collection. If the collection does not currently exist, insert operations will create the collection.
MongoDB provides the following methods to insert documents into a collection:
db.collection.insertOne()New in version 3.2db.collection.insertMany()New in version 3.2
In MongoDB, insert operations target a single collection. All write operations in MongoDB are atomic on the level of a single document.
For examples, see Insert Documents.
Read Operations
Read operations retrieves documents from a collection; i.e. queries a collection for documents. MongoDB provides the following methods to read documents from a collection:
You can specify query filters or criteria that identify the documents to return.
For examples, see:
Update Operations
Update operations modify existing documents in a collection. MongoDB provides the following methods to update documents of a collection:
db.collection.updateOne()New in version 3.2db.collection.updateMany()New in version 3.2db.collection.replaceOne()New in version 3.2
In MongoDB, update operations target a single collection. All write operations in MongoDB are atomic on the level of a single document.
You can specify criteria, or filters, that identify the documents to update. These filters use the same syntax as read operations.
For examples, see Update Documents.
Delete Operations
Delete operations remove documents from a collection. MongoDB provides the following methods to delete documents of a collection:
db.collection.deleteOne()New in version 3.2db.collection.deleteMany()New in version 3.2
In MongoDB, delete operations target a single collection. All write operations in MongoDB are atomic on the level of a single document.
You can specify criteria, or filters, that identify the documents to remove. These filters use the same syntax as read operations.
For examples, see Delete Documents.
Bulk Write
MongoDB provides the ability to perform write operations in bulk. For details, see Bulk Write Operations.
5.MongoDB CRUD Operations-官方文档摘录的更多相关文章
- Cocos Creator 加载和切换场景(官方文档摘录)
Cocos Creator 加载和切换场景(官方文档摘录) 在 Cocos Creator 中,我们使用场景文件名( 可以不包含扩展名)来索引指代场景.并通过以下接口进行加载和切换操作: cc.dir ...
- ng的概念层次(官方文档摘录)
官方文档是这么说的: You write Angular applications by: composing HTML templates with Angularized markup, writ ...
- Cocos Creator 使用计时器(官方文档摘录)
在 Cocos Creator 中,我们为组件提供了方便的计时器,这个计时器源自于 Cocos2d-x 中的 cc.Scheduler,我们将它保留在了 Cocos Creator 中并适配了基于组件 ...
- Cocos Creator 生命周期回调(官方文档摘录)
Cocos Creator 为组件脚本提供了生命周期的回调函数.用户通过定义特定的函数回调在特定的时期编写相关 脚本.目前提供给用户的声明周期回调函数有: onLoad start update la ...
- angular 模板语法(官方文档摘录)
https://angular.cn/guide/template-syntax {{}} 和"" 如果嵌套,{{}}里面求完值,""就是原意 <h3&g ...
- Qt元类型(MetaType)注册入门(附一些官方文档的关键摘录)
昨天调试项目时,突然发现如下消息: QObject::connect: Cannot queue arguments of type 'ERROR_LEVEL' (Make sure 'ERROR_L ...
- Spring Data Commons 官方文档学习
Spring Data Commons 官方文档学习 -by LarryZeal Version 1.12.6.Release, 2017-07-27 为知笔记版本在这里,带格式. Table o ...
- Spark官方文档 - 中文翻译
Spark官方文档 - 中文翻译 Spark版本:1.6.0 转载请注明出处:http://www.cnblogs.com/BYRans/ 1 概述(Overview) 2 引入Spark(Linki ...
- Spark SQL 官方文档-中文翻译
Spark SQL 官方文档-中文翻译 Spark版本:Spark 1.5.2 转载请注明出处:http://www.cnblogs.com/BYRans/ 1 概述(Overview) 2 Data ...
- Spark Streaming官方文档学习--上
官方文档地址:http://spark.apache.org/docs/latest/streaming-programming-guide.html Spark Streaming是spark ap ...
随机推荐
- PHPCMS 后台学习
1.final 不能被子类改写,不可扩展2.私有不能被继承3.构造方法,第一个被调用的方法4.static访问 类名::方法名 parent::test();这里test可以不静态 m=模块名& ...
- FileMonitorKit 文件操作监控工具
本人业余时间写的一款文件操作监控工具,功能稳定.效果非常好,有兴趣的网友能够下载玩玩. 下载地址: 32位:http://pan.baidu.com/s/1o64ZFIi FileM ...
- [转]Mac系统安装软件提示软件已损坏的解决办法
很多朋友下载本站提供的Mac软件资源,安装提示“xxx软件已损坏,打不开,您应该将它移到废纸篓”的提示,其实并不是软件本身有问题,而是Mac系统的一个安全机制问题,按照如下方法操作,即可打开并安装本站 ...
- 分析kube-proxy的iptables规则
NodePort service 创建一个mysql的NodePort服务,对应两个pod实例,rc和service的配置如下: 1.rc配置 apiVersion: v1 kind: Replica ...
- JAVA8之lambda表达式详解,及stream中的lambda使用
分享文章:https://blog.csdn.net/jinzhencs/article/details/50748202
- python笔记-基础入门
Python 特点 1.易于学习:Python有相对较少的关键字,结构简单,和一个明确定义的语法,学习起来更加简单. 2.易于阅读:Python代码定义的更清晰. 3.易于维护:Python的成功在于 ...
- ubuntu14.04安装pycurl
一. 安装依赖项 sudo apt-get install libcurl4-gnutls-dev 二. 安装pycurl pip install pycurl 三. 检验是否安装成功 进入pytho ...
- 8、手把手教React Native实战之ReactJS组件生命周期
1.创建阶段 getDefaultProps:处理props的默认值 在React.createClass调用 2.实例化阶段 React.render(<HelloMessage 启动之后 g ...
- MAMP下配置虚拟主机域名
第一步:修改虚拟主机地址: /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf 第二步:
- 笔试面试的路上——努力ing
积累: 最值得阅读学习的 10 个 C 语言开源项目代码 改变计算技术的 9 个伟大算法 程序员选修课丨追妹子的各种算法 追 MM 和设计模式:趣解 23 种设计模式 设计高可用性.容错和数据隔离的H ...