Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-93005

Avoid duplicating read preference when running an exhaust query in the shell

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0, 7.3.4, 8.0.0-rc16
    • Affects Version/s: None
    • Component/s: None
    • None
    • Workload Scheduling
    • Fully Compatible
    • ALL
    • v8.0, v7.3, v7.0
    • Hide

      In the shell, run the following code:

      db.getMongo().setReadPref('secondary');
      db.getCollection("argleBargle").find().addOption(DBQuery.Option.exhaust).itcount()
      
      Show
      In the shell, run the following code: db.getMongo().setReadPref( 'secondary' ); db.getCollection( "argleBargle" ).find().addOption(DBQuery.Option.exhaust).itcount()
    • Workload Scheduling 2024-08-05
    • 0

      When running an exhaust query in the shell, we call the built-in find rather than runCommand: https://github.com/10gen/mongo/blob/3639fdb2758f07a85958fcf28e24cf0056c1d8e8/src/mongo/shell/query.js#L130-L156

      Since find has read preference as an explicit argument, we get the read preference (if any) from the command object and pass it to find, which internally ends up adding it to the op message, resulting in a duplicate read preference.

            Assignee:
            vojislav.stojkovic@mongodb.com Vojislav Stojkovic
            Reporter:
            vojislav.stojkovic@mongodb.com Vojislav Stojkovic
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: