mongodb笔记
来源:互联网 发布:特征匹配算法 编辑:程序博客网 时间:2024/04/28 01:43
最大的BSON文档的大小是16兆,超过这个大小需要使用GrdiFS API
文档需要_id域作为主键,如果没有指定_id域,那么会使用ObjectIds 作为默认值。
对于WiredTiger storage engine readConcern选项允许选择读的隔离级别,可以使用majority,这个级别可以读写入到replica set大部分成员中的数据,不可回滚。
MMAPv1 存储引擎,只能指定local级别
默认情况下mongodb使用local级别,不保证读的数据不会回滚。
level Description
“local”
Default. The query returns the instance’s most recent copy of data. Provides no guarantee that the data has been written to a majority of the replica set members.
“majority”
The query returns the instance’s most recent copy of data confirmed as written to a majority of members in the replica set.
To use a read concern level of “majority”, you must use the WiredTiger storage engine and start the mongod instances with the –enableMajorityReadConcern command line option (or the replication.enableMajorityReadConcern setting if using a configuration file).
Only replica sets using protocol version 1 support “majority” read concern. Replica sets running protocol version 0 do not support “majority” read concern.
To ensure that a single thread can read its own writes, use “majority” read concern and “majority” write concern against the primary of the replica set.
mongodb中一个写操作,如果这个写操作修改了一个记录,那么是原子操作,如果这个写操作修改了几个记录,那么对每个记录来说是原子操作,但是整体上不是一个原子操作,可以使用
一个隔离的写操作不会提供“all-or-nothing”的原子性,不会回滚遇到错误之前的所有的改变。
并发控制,mongodb中使用下面2个方法:
1创建唯一索引
2Another approach is to specify the expected current value of a field in the query predicate for the write operations.
Read uncommitted is the default isolation level and applies to mongod standalone instances as well as to replica sets and sharded clusters.
- MongoDB笔记
- MongoDB笔记
- MongoDB笔记
- MongoDB笔记
- mongodb笔记
- MongoDB 笔记
- MongoDB笔记
- mongodb笔记
- Mongodb笔记
- mongoDB笔记
- mongodb笔记
- mongodb笔记
- MongoDB笔记
- mongodb 笔记
- Mongodb笔记
- mongodb笔记
- mongodb笔记
- mongodb 笔记
- Build Android4.0 Launcher
- 2016 年全国房价会呈什么趋势?
- android Log详解(Log.v,Log.d,Log.i,Log.w,Log.e)
- CA证书出错,请登录微信支付商户平台下载证书
- java的单例设计模式
- mongodb笔记
- c++链表类创建使用
- 滴滴全球Di-Tech算法大赛落幕 中国选手夺得10万美元大奖
- 解决问题:javax.mail.MessagingException: Could not connect to SMTP host: smtp.exmail.qq.com, port: 25;
- akka-actor-01
- poj3436--网络流
- NDK开发——Android Studio实现JNI
- Android 杂记
- 面向对象设计原则和创建SOLID应用的5个方法