- Reference >
- mongo Shell Methods >
- Cursor Methods >
- cursor.readConcern()
cursor.readConcern()¶
On this page
Definition¶
- cursor.readConcern(level)¶
New in version 3.2.
Specify a read concern for the db.collection.find() method.
The readConcern() method has the following form:
db.collection.find().readConcern(<level>)
The readConcern() method has the following parameter:
Parameter Type Description level string Optional. One of the following read concern modes: "local" or "majority" 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.
See also
Thank you for your feedback!
We're sorry! You can Report a Problem to help us improve this page.