您的位置:首页 > 数据库 > Mongodb

Mongodb 重要点

2016-03-25 12:06 375 查看
不支持事务,在单文档记录上原子操作而已。

有个$isolation 只能保证多个文档更新直到最后才让其它客户端看到,但可能部分成功,且不能用于sharding cluster

默认隔离级别是read uncommitted(durable 之前)。。。

副本模式的一致性: 3.2版本开始有读多数和多主的选项来保证

journal 预先记录日志,也是采用内存。journal刷到磁盘的间隔是可配的,尽量配在与数据磁盘不同的磁盘

写的时候

可以指定参数 副本确认数或者majority,以及journal 是否为true

Changed in version 3.2: For replica sets using protocolVersion: 1 and running with the journalenabled:

w: "majority" implies j: true.

Secondary members acknowledge replicated write operations after the secondary members have written to their respective on-disk journals, regardless of the j option used for the write on the primary.

读的时候

MongoDB 3.2 introduces the readConcern query option for replica sets and replica set shards. By default, MongoDB uses a read concern of "local" to return the most recent data available to the MongoDB instance at the time of the query, even if the data has not been persisted to a majority of replica set members and may be rolled back.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: