Skip to content

Commit 91ba19e

Browse files
authored
fix: ensure cursor readPreference is applied to find operations (#2751)
1 parent f2a4ff8 commit 91ba19e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/operations/find.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ class FindOperation extends OperationBase {
2020
// copied from `CommandOperationV2`, to be subclassed in the future
2121
this.server = server;
2222

23+
// updates readPreference if setReadPreference was called on the cursor
24+
this.readPreference = ReadPreference.resolve(this, this.options);
25+
2326
if (typeof this.cmd.allowDiskUse !== 'undefined' && maxWireVersion(server) < 4) {
2427
callback(new MongoError('The `allowDiskUse` option is not supported on MongoDB < 3.2'));
2528
return;

0 commit comments

Comments
 (0)