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

Commit 259231e

Browse files
committedFeb 27, 2019
fix(topology): correctly pick up command options for cursors
The cursor code also uses `selectServers` but passes its options in as the first parameter, rather than a server selector.
1 parent 97943a2 commit 259231e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed
 

‎lib/sdam/topology.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,16 @@ class Topology extends EventEmitter {
291291
* @return {Server} An instance of a `Server` meeting the criteria of the predicate provided
292292
*/
293293
selectServer(selector, options, callback) {
294-
if (typeof options === 'function') (callback = options), (options = {});
294+
if (typeof options === 'function') {
295+
callback = options;
296+
if (typeof selector !== 'function') {
297+
options = selector;
298+
selector = readPreferenceServerSelector(options.readPreference);
299+
} else {
300+
options = {};
301+
}
302+
}
303+
295304
options = Object.assign(
296305
{},
297306
{ serverSelectionTimeoutMS: this.s.serverSelectionTimeoutMS },

0 commit comments

Comments
 (0)
This repository has been archived.