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 ...
随机推荐
- LFCS 系列第八讲:管理用户和用户组、文件权限和属性以及启用账户 sudo 访问权限
由于 Linux 是一个多用户的操作系统(允许多个用户通过不同主机或者终端访问一个独立系统),因此你需要知道如何才能有效地管理用户:如何添加.编辑.禁用和删除用户账户,并赋予他们足以完成自身任务的必要 ...
- Http basic Auth 认证方式帮助类
BasicAuthenticationUtil import java.io.IOException; import java.security.MessageDigest; import javax ...
- [Egret]长按截屏分享、分享截屏图片、本地存储
egret 分享有API可以把一个显示对象树渲染成一个位图纹理,我把它赋值给 HTML 的 Image 元素,就实现了图片的显示,在微信中,通过长按图片可以分享出去.当然在其他浏览器可以保存在本地. ...
- Oracle之函数concat、lpad
一.引言 程序测试需要生成大量的测试数据,且测试数据有主键,主键自增,于是决定用存储过程来实现,经过半天的查资料终于完成了,记录之,学习之 二.存储过程 格式: CREATE PROCEDURE re ...
- CMU-15445 LAB2:实现一个支持并发操作的B+树
概述 经过几天鏖战终于完成了lab2,本lab实现一个支持并发操作的B+树.简直B格满满. B+树 为什么需要B+树 B+树本质上是一个索引数据结构.比如我们要用某个给定的ID去检索某个student ...
- linux 查找文件并移动
find . -name '10-*.dat' -exec mv {} ../ \; 这里: => -exec mv {} /mnt/mp3 \; - 运行mv命令. => {} ...
- Github上fork项目后与原项目保持同步
**步骤** 假设来源为 `https://github.com/_original/_project.git` fork 项目为 `https://github.com/_your/_projec ...
- java请求POST发送json格式请求
public static String upload(String url){ try { HttpClient httpclient = new DefaultHttpClient(); Http ...
- vb 定时执行php程序
托盘模块 Option Explicit Public Const NIF_ICON = &H2 Public Const NIF_MESSAGE = &H1 Public Const ...
- jquery mobile demo
<!DOCTYPE html> <html> <head> <title>jQuery Mobile Demo</title> <me ...