Skip to content
This repository has been archived by the owner on Feb 4, 2022. It is now read-only.

Commit

Permalink
fix(topology): correctly pick up command options for cursors
Browse files Browse the repository at this point in the history
The cursor code also uses `selectServers` but passes its options
in as the first parameter, rather than a server selector.
  • Loading branch information
mbroadst committed Feb 27, 2019
1 parent 97943a2 commit 259231e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/sdam/topology.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,16 @@ class Topology extends EventEmitter {
* @return {Server} An instance of a `Server` meeting the criteria of the predicate provided
*/
selectServer(selector, options, callback) {
if (typeof options === 'function') (callback = options), (options = {});
if (typeof options === 'function') {
callback = options;
if (typeof selector !== 'function') {
options = selector;
selector = readPreferenceServerSelector(options.readPreference);
} else {
options = {};
}
}

options = Object.assign(
{},
{ serverSelectionTimeoutMS: this.s.serverSelectionTimeoutMS },
Expand Down

0 comments on commit 259231e

Please sign in to comment.