[CXX-1215] Implement `transform_document` helper Created: 31/Jan/17  Updated: 02/Feb/17  Resolved: 02/Feb/17

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

Type: Task Priority: Major - P3
Reporter: Samuel Rossi (Inactive) Assignee: Samuel Rossi (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Because bsoncxx::document::value (and bsoncxx::document::view) are immutable, changing a field in a document requires building a new document from scratch, which is cumbersome (especially with deeply-nested fields). To facilitate creating copies of documents with changed fields, a `transform_document` function should be implemented.



 Comments   
Comment by Githook User [ 02/Feb/17 ]

Author:

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

Message: CXX-1215 client_helpers.cpp: remove dup include of error_code.hpp
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/0148d11a3de6b05906146859412f783aa74bdd41

Comment by Githook User [ 02/Feb/17 ]

Author:

{u'username': u'saghm', u'name': u'Saghm Rossi', u'email': u'saghmrossi@gmail.com'}

Message: CXX-1215 Change transform_document() to throw on error, not assert
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/2429114e290e6e788f3f575b37a7be718f90b39a

Comment by J Rassi [ 01/Feb/17 ]

Re-opening to address build failure introduced by the above:

/Users/rassi/work/mongo-cxx-driver/src/mongocxx/test_util/client_helpers.cpp:145:9: error: use of
      undeclared identifier 'assert'
        assert(transformed->first);
        ^
1 error generated.
make[2]: *** [src/mongocxx/test/CMakeFiles/test_specs.dir/__/test_util/client_helpers.cpp.o] Error 1

Comment by Githook User [ 01/Feb/17 ]

Author:

{u'username': u'saghm', u'name': u'Saghm Rossi', u'email': u'saghmrossi@gmail.com'}

Message: CXX-1215 Implement `transform_document` helper
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/62b2c063c478e635b3f0fbe29af5364001a11fb9

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