Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-1022

$query must be provided with $readPreference

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.3.0-rc0
    • Affects Version/s: 1.3.0-beta0
    • Component/s: libmongoc
    • Labels:
      None

      The driver can incorrectly send OP_QUERY to mongos with a read preference like:

      {$readPreference:{mode:'secondary'}}
      

      mongos 2.4 returns "BadValue: cannot canonicalize query". Later mongoses accept this format. Regardless, according to Server Selection Spec, if the query filter is empty it must be included anyway:

      {$query:{}, $readPreference:{mode:'secondary'}}
      

      This format works with all supported versions of mongos.

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: