[CDRIVER-1022] $query must be provided with $readPreference Created: 23/Nov/15  Updated: 08/Dec/15  Resolved: 23/Nov/15

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: 1.3.0-beta0
Fix Version/s: 1.3.0-rc0

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

Issue Links:
Duplicate
is duplicated by CDRIVER-986 OP_QUERY can be sent with $readPrefer... Closed

 Description   

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.



 Comments   
Comment by Githook User [ 23/Nov/15 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-1022 $query must be provided with $readPreference
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/76fe4f6d53a534d9d5c8d86d59b90c0b606a3ba2

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