GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
BSON_ITER_INIT_FROM_DATA_AT_OFFSET(3) libbson BSON_ITER_INIT_FROM_DATA_AT_OFFSET(3)

bool
bson_iter_init_from_data_at_offset (bson_iter_t *iter,

const uint8_t *data,
size_t length,
uint32_t offset,
uint32_t keylen);


  • iter: A bson_iter_t.
  • data: A buffer to initialize with. This is not validated.
  • length: The length of data in bytes. This is not validated.
  • offset: The offset of the field to start iterating. This is not validated. This should be an offset previously obtained from bson_iter_offset().
  • keylen: The string length of the key of the field to start iterating. This is not validated. This should be a length previously obtained from bson_iter_key_len().

Creates a bson_iter_t and starts iteration on a field at the offset.

bson_iter_init_from_data_at_offset() is useful for situations where the progress of a bson_iter_t must be saved and restored without relying on the bson_iter_t data layout. Saving the progress could be accomplished by:

  • Saving the current field's key length with bson_iter_key_len()
  • Saving the current offset with bson_iter_offset()
  • Saving the data pointer of the iterated bson_t with bson_get_data()
  • Saving the data length of the iterated bson_t with the len struct field

Then later, these saved values can be passed to bson_iter_init_from_data_at_offset() to reconstruct the bson_iter_t in constant time.

Returns true if the iter was successfully initialized.

SEE ALSO:

bson_iter_key_len()

bson_iter_offset()

bson_get_data()



MongoDB, Inc

2009-present, MongoDB, Inc.

July 3, 2025 1.30.4

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.