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

OP_QUERY can be sent with $readPreference but no $query

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • TBD
    • Affects Version/s: None
    • Component/s: libmongoc
    • Labels:
      None

      See test_read_prefs_mongos_secondary(). Given an empty query and a read preference, mongoc_collection_find() can send a document like this to mongos:

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

      Mismatches the Server Selection Spec:

      When any $ modifier is used, including the $readPreference modifier, the query MUST be provided using the $query modifier

      The driver should send:

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

      https://github.com/mongodb/specifications/blob/master/source/server-selection/server-selection.rst

            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: