- Reference >
mongoShell 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:The
readConcern()method has the following parameter:Parameter Type Description levelstring 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 themongodinstances with the--enableMajorityReadConcerncommand line option (or thereplication.enableMajorityReadConcernsetting if using a configuration file).Only replica sets using
protocol version 1support"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