MongoDB - MongoDB CRUD Operations
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.insert()
- db.collection.insertOne() New in version 3.2
- db.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 Query Documents.
Update Operations
Update operations modify existing documents in a collection. MongoDB provides the following methods to update documents of a collection:
- db.collection.update()
- db.collection.updateOne() New in version 3.2
- db.collection.updateMany() New in version 3.2
- db.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.remove()
- db.collection.deleteOne() New in version 3.2
- db.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.
MongoDB - MongoDB CRUD Operations的更多相关文章
- MongoDB - MongoDB CRUD Operations, Bulk Write Operations
Overview MongoDB provides clients the ability to perform write operations in bulk. Bulk write operat ...
- MongoDB - MongoDB CRUD Operations, Delete Documents
Delete Methods MongoDB provides the following methods to delete documents of a collection: Method De ...
- MongoDB - MongoDB CRUD Operations, Insert Documents
MongoDB provides the following methods for inserting documents into a collection: db.collection.inse ...
- MongoDB - MongoDB CRUD Operations, Update Documents
Update Methods MongoDB provides the following methods for updating documents in a collection: Method ...
- MongoDB的CRUD操作
1. 前言 在上一篇文章中,我们介绍了MongoDB.现在,我们来看下如何在MongoDB中进行常规的CRUD操作.毕竟,作为一个存储系统,它的基本功能就是对数据进行增删改查操作. MongoDB中的 ...
- [MongoDB]MongoDB与JAVA结合使用CRUD
汇总: 1. [MongoDB]安装MongoDB2. [MongoDB]Mongo基本使用:3. [MongoDB]MongoDB的优缺点及与关系型数据库的比较4. [MongoDB]MongoDB ...
- MongoDB简单CRUD场景
MongoDB简单CRUD命令操作 (1)新建数据库:use 数据库名 (2)显示所有数据库:show dbs; (3)新建集合(两种方式) 隐式创建:在创建集合的同时往集合里面添加数据---db. ...
- springboot连接mongodb进行CRUD
springboot连接mongodb进行CRUD的过程: 在执行以下操作前已安装了mongodb并创建了用户和数据库,使用Robo 3T可成功连接. 1.创建springboot项目,加入以下mav ...
- [MongoDB]MongoDB的优缺点及与关系型数据库的比较
汇总: 1. [MongoDB]安装MongoDB2. [MongoDB]Mongo基本使用:3. [MongoDB]MongoDB的优缺点及与关系型数据库的比较4. [MongoDB]MongoDB ...
随机推荐
- chrome 41 空格
chrome 41对半角空格的解析 当做一个汉字宽度来处理了. 导致很多网站出现异常. 目前能想到的方法是删掉用来规范格式的空格. 老版chrome chrome41 和讯网也有这种问题 有更好的处理 ...
- 利用FlashPaper实现类似百度文库功能
最近需要实现一个类似百度文库的功能,在Google上淘了一段时间,发现FlashPaper还算能够不错的实现此需求. 首先讲下思路: 1>安装FlashPaper: 2>利用java代码将 ...
- [置顶] Android AlarmManager实现不间断轮询服务
在消息的获取上是选择轮询还是推送得根据实际的业务需要来技术选型,例如对消息实时性比较高的需求,比如微博新通知或新闻等那就最好是用推送了.但如果只是一般的消息检测比如更新检查,可能是半个小时或一个小时一 ...
- hihocoder #1178 : 计数 暴力
#1178 : 计数 Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://hihocoder.com/problemset/problem/1178 ...
- Java中this,static,super及finalkeyword和代码块
this: 能够使用this表示类中的属性------this.name=name 能够使用this强调调用的是本类的方法 能够使用this调用本类的构造方法------this();调用本类中无參构 ...
- SQL Server数据库大型应用解决方案总结
随着互联网应用的广泛普及,海量数据的存储和访问成为了系统设计的瓶颈问题.对于一个大型的互联网应用,每天百万级甚至上亿的PV无疑对数据库造成了相当高的负载.对于系统的稳定性和扩展性造成了极大的问题. 一 ...
- 关于MonoDevelop自动缩进的设置
monoDevelop 下载地址:http://monodevelop.com/Download 下载安装之后,可在unity Edit->Preference->External Too ...
- javascript------>delete
delete只能删除属性,不能删除变量 var a = "roboce"; delete a; // false a; b = "haha"; delete b ...
- oc-25- @property @synthesize
s.h #import <Foundation/Foundation.h> @interface Student : NSObject { @public NSString *_name; ...
- 基于jQuery的宽屏可左右切换的焦点图插件
之前分享了很多实用的jQuery焦点图插件,大家可以看看.今天要继续为大家分享一款很不错的jQuery焦点图插件,它是宽屏展示的,而且有两个大气的按钮用来左右切换图片.效果图如下: 在线预览 源码 ...