Skip to content

Commit

Permalink
fix: ensure cursor readPreference is applied to find operations (#2751)
Browse files Browse the repository at this point in the history
  • Loading branch information
emadum committed Mar 25, 2021
1 parent f2a4ff8 commit 91ba19e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/operations/find.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ class FindOperation extends OperationBase {
// copied from `CommandOperationV2`, to be subclassed in the future
this.server = server;

// updates readPreference if setReadPreference was called on the cursor
this.readPreference = ReadPreference.resolve(this, this.options);

if (typeof this.cmd.allowDiskUse !== 'undefined' && maxWireVersion(server) < 4) {
callback(new MongoError('The `allowDiskUse` option is not supported on MongoDB < 3.2'));
return;
Expand Down

0 comments on commit 91ba19e

Please sign in to comment.