[CDRIVER-2467] Provide a way to synthesize a bson_iter_t from a known offset Created: 23/Jan/18  Updated: 28/Oct/23  Resolved: 26/Jul/18

Status: Closed
Project: C Driver
Component/s: libbson
Affects Version/s: None
Fix Version/s: 1.13.0

Type: Improvement Priority: Major - P3
Reporter: Andrew Morrow (Inactive) Assignee: Kevin Albertson
Resolution: Fixed Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by CXX-1499 Don't access bson_iter_t internals Closed
Related
is related to CDRIVER-2064 Add bson_iter_init_from_data function Closed
Epic Link: libbson iter api

 Description   

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.



 Comments   
Comment by Githook User [ 26/Jul/18 ]

Author:

{'username': 'kevinAlbs', 'name': 'Kevin Albertson', 'email': 'kevin.albertson@10gen.com'}

Message: CDRIVER-2467 use uint32_t instead of int
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/e65386b41a4a30033eef8fe3cb925abf1fc6d093

Comment by Githook User [ 25/Jul/18 ]

Author:

{'name': 'Kevin Albertson', 'email': 'kevin.albertson@10gen.com', 'username': 'kevinAlbs'}

Message: CDRIVER-2467 fix travis
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/d0f3f8a163ae3489e07ca72f63ca4013720f5da8

Comment by Githook User [ 25/Jul/18 ]

Author:

{'username': 'kevinAlbs', 'name': 'Kevin Albertson', 'email': 'kevin.albertson@10gen.com'}

Message: CDRIVER-2467 create bson_iter_t from offset
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/eb556c6e7fcf0cc132228ae68989c3512557b378

Generated at Wed Feb 07 21:15:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.