-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: libbson
The C++ driver has a need to synthesize a bson_iter_t at a known offset within a document.
Currently, it resorts to messing around with the internals of bson_iter_t to accomplish that:
- https://github.com/mongodb/mongo-cxx-driver/blob/master/src/bsoncxx/document/element.cpp#L29-L34
- https://github.com/mongodb/mongo-cxx-driver/blob/master/src/bsoncxx/document/view.cpp#L31-L36
It would be much better for the C++ driver if the C driver offered bson_iter_init_from_data_and_offset, which worked like bson_iter_init_from_data, but also took an offset into the object.
Without this, the C++ driver can only correct this misuse of the C driver by either:
- Exposing the bson_iter_t as a member of the document,array::element class, which would break the encapsulation of the C driver, and make us ABI dependent.
- Putting a type erased bson_iter_t on the heap for every document,array::view class, which would defeat performance of view types.
Neither of the above seems palatable.
- is depended on by
-
CXX-1499 Don't access bson_iter_t internals
- Closed
- is related to
-
CDRIVER-2064 Add bson_iter_init_from_data function
- Closed