Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-2467

Provide a way to synthesize a bson_iter_t from a known offset

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.13.0
    • Affects Version/s: None
    • Component/s: libbson
    • Labels:

      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:

      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.

            Assignee:
            kevin.albertson@mongodb.com Kevin Albertson
            Reporter:
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: