[CXX-1093] collection::distinct() should return error to user if collation specified and connection max wire version < 5 Created: 19/Oct/16  Updated: 13/Dec/16  Resolved: 17/Nov/16

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

Type: Bug Priority: Major - P3
Reporter: J Rassi Assignee: David Golden
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-1052 Port CRUD methods to use C driver 1.5... Closed
Related
related to CXX-971 Support providing collation per opera... Closed
Backwards Compatibility: Minor Change

 Description   

Currently, no error is returned to the user.

The work for this ticket consists of migrating the collection::distinct() implementation to use mongoc_collection_read_command_with_opts().



 Comments   
Comment by Githook User [ 29/Nov/16 ]

Author:

{u'username': u'xdg', u'name': u'David Golden', u'email': u'xdg@xdg.me'}

Message: CXX-1093 Implement distinct via read command with opts
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/37ae0a1f4b7ef94d0401856547ceaf0ad5ce2b68

Comment by David Golden [ 17/Nov/16 ]

It introduces a new error condition that might trip someone up who was playing with collation and didn't realize that distinct wasn't throwing an error when it should be. I marked it "minor" to remind us to think about it later. We might not even need to mention it.

Comment by J Rassi [ 17/Nov/16 ]

David, what's your thinking behind marking this ticket as a minor backwards-incompatible change? This ticket looks like a pure bugfix to me, and I think of all pure bugfixes as backwards-compatible (since they fix the implementation, not the documented behavior). I could have missed something else that went into this rewrite, though.

Comment by Githook User [ 17/Nov/16 ]

Author:

{u'username': u'xdg', u'name': u'David Golden', u'email': u'xdg@xdg.me'}

Message: CXX-1093 Implement distinct via read command with opts
Branch: 3.1-dev
https://github.com/mongodb/mongo-cxx-driver/commit/37ae0a1f4b7ef94d0401856547ceaf0ad5ce2b68

Comment by David Golden [ 11/Nov/16 ]

Implementation notes:

  • This returns a mongocxx::cursor, but mongoc_collection_read_command_with_opts returns only a result document
  • We can synthesize a cursor command response, with the single document being the result document
  • We can then generate a libmongoc cursor from mongoc_cursor_new_from_command_reply and use that to instantiate the mongocxx::cursor to return

This is clunky, but preserves the current API. Fixing the API will be done as part of the version 4.0 driver (CXX-1126).

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