[CXX-1045] collection::count() serializes options::count::hint incorrectly Created: 22/Sep/16  Updated: 19/Oct/16  Resolved: 08/Oct/16

Status: Closed
Project: C++ Driver
Component/s: Implementation
Affects Version/s: None
Fix Version/s: 3.0.3

Type: Bug Priority: Major - P3
Reporter: J Rassi Assignee: J Rassi
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by CXX-971 Support providing collation per opera... Closed

 Description   

collection::count() incorrectly serializes the hint object in the count request with a field name of "$hint" instead of "hint". When the server receives the incorrect count option "$hint", it is ignored.

As a result, passing an options::count object to collection::count which has a hint set will have no effect.



 Comments   
Comment by Githook User [ 08/Oct/16 ]

Author:

{u'username': u'jrassi', u'name': u'J. Rassi', u'email': u'rassi@10gen.com'}

Message: CXX-1045 collection::count() correctly serialize options::count::hint

collection::count() was previously using the invalid count command
option "$hint" to issue hinted count operations. This commit corrects
the option name to "hint".
Branch: 3.1-dev
https://github.com/mongodb/mongo-cxx-driver/commit/c2377b08d3aeebd09bfc8607daafe0dedaa33dfe

Comment by Githook User [ 08/Oct/16 ]

Author:

{u'username': u'jrassi', u'name': u'J. Rassi', u'email': u'rassi@10gen.com'}

Message: CXX-1045 Add hint::to_value(), deprecate hint::to_document()

The design of hint::to_document() is flawed in that it returns a
document with a fixed key name of "$hint", which doesn't always
represent the hint option correctly for database operations (commands
take this option with a key name of "hint", for example).

To address this issue, this commit removes knowledge of the key name
from the hint class, by adding hint::to_value() and deprecating
hint::to_document().
Branch: 3.1-dev
https://github.com/mongodb/mongo-cxx-driver/commit/a8bf8d1c7b1b000fcddfe57ca3c6843fd07f3794

Comment by Githook User [ 08/Oct/16 ]

Author:

{u'username': u'jrassi', u'name': u'J. Rassi', u'email': u'rassi@10gen.com'}

Message: CXX-1045 collection::count() correctly serialize options::count::hint

collection::count() was previously using the invalid count command
option "$hint" to issue hinted count operations. This commit corrects
the option name to "hint".
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/c2377b08d3aeebd09bfc8607daafe0dedaa33dfe

Comment by Githook User [ 08/Oct/16 ]

Author:

{u'username': u'jrassi', u'name': u'J. Rassi', u'email': u'rassi@10gen.com'}

Message: CXX-1045 Add hint::to_value(), deprecate hint::to_document()

The design of hint::to_document() is flawed in that it returns a
document with a fixed key name of "$hint", which doesn't always
represent the hint option correctly for database operations (commands
take this option with a key name of "hint", for example).

To address this issue, this commit removes knowledge of the key name
from the hint class, by adding hint::to_value() and deprecating
hint::to_document().
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/a8bf8d1c7b1b000fcddfe57ca3c6843fd07f3794

Comment by J Rassi [ 22/Sep/16 ]

https://github.com/mongodb/mongo-cxx-driver/pull/541

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