You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: lib/query.js
+45
Original file line number
Diff line number
Diff line change
@@ -1141,6 +1141,51 @@ Query.prototype.wtimeout = function wtimeout(ms) {
1141
1141
returnthis;
1142
1142
};
1143
1143
1144
+
/**
1145
+
* Sets the readConcern option for the query.
1146
+
*
1147
+
* ####Example:
1148
+
*
1149
+
* new Query().readConcern('local')
1150
+
* new Query().readConcern('l') // same as local
1151
+
*
1152
+
* new Query().readConcern('available')
1153
+
* new Query().readConcern('a') // same as available
1154
+
*
1155
+
* new Query().readConcern('majority')
1156
+
* new Query().readConcern('m') // same as majority
1157
+
*
1158
+
* new Query().readConcern('linearizable')
1159
+
* new Query().readConcern('lz') // same as linearizable
1160
+
*
1161
+
* new Query().readConcern('snapshot')
1162
+
* new Query().readConcern('s') // same as snapshot
1163
+
*
1164
+
*
1165
+
* ####Read Concern Level:
1166
+
*
1167
+
* local MongoDB 3.2+ The query returns from the instance with no guarantee guarantee that the data has been written to a majority of the replica set members (i.e. may be rolled back).
1168
+
* available MongoDB 3.6+ The query returns from the instance with no guarantee guarantee that the data has been written to a majority of the replica set members (i.e. may be rolled back).
1169
+
* majority MongoDB 3.2+ The query returns the data that has been acknowledged by a majority of the replica set members. The documents returned by the read operation are durable, even in the event of failure.
1170
+
* linearizable MongoDB 3.4+ The query returns data that reflects all successful majority-acknowledged writes that completed prior to the start of the read operation. The query may wait for concurrently executing writes to propagate to a majority of replica set members before returning results.
1171
+
* snapshot MongoDB 4.0+ Only available for operations within multi-document transactions. Upon transaction commit with write concern "majority", the transaction operations are guaranteed to have read from a snapshot of majority-committed data.
1172
+
*
1173
+
* Aliases
1174
+
*
1175
+
* l local
1176
+
* a available
1177
+
* m majority
1178
+
* lz linearizable
1179
+
* s snapshot
1180
+
*
1181
+
* Read more about how to use read concern [here](https://docs.mongodb.com/manual/reference/read-concern/).
1182
+
*
1183
+
* @param {String} level one of the listed read concern level or their aliases
0 commit comments