- 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: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 themongod
instances with the--enableMajorityReadConcern
command line option (or thereplication.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