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
- duplicates
-
CDRIVER-1022 $query must be provided with $readPreference
- Closed