Cursor.prototype.count() is not respecting parent ReadPreference

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 3.1.0
    • Affects Version/s: None
    • Component/s: Native
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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.

            Assignee:
            Rebecca Weinberger (Inactive)
            Reporter:
            Daniel Aprahamian (Inactive)
            None
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: