[CDRIVER-986] OP_QUERY can be sent with $readPreference but no $query Created: 05/Nov/15  Updated: 03/May/17  Resolved: 24/Nov/15

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: None
Fix Version/s: TBD

Type: Bug Priority: Minor - P4
Reporter: A. Jesse Jiryu Davis Assignee: A. Jesse Jiryu Davis
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates CDRIVER-1022 $query must be provided with $readPre... Closed

 Description   

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


Generated at Wed Feb 07 21:11:13 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.