-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Native
-
None
-
Empty show more show less
The following code will execute against the primary instead of the secondary:
const url = 'mongodb://user:password@localhost:27018,localhost:27017,localhost:27019/test?replicaSet=replset'; MongoClient.connect(url, { readPreference: ReadPreference.SECONDARY }, (err, client) => { const cursor = db.collection('test').find({}); cursor.count().then(count => console.log("count: " + count)); });
It appears that the cursor does not respect the read preference of its parents.