BSON_OID_INIT_SEQUENCE(3)

πŸ’– BSON_OID_INIT_SEQUENCE πŸ’–

okay so bestie, we're in the libbson section of the manual, page BSON_OID_INIT_SEQUENCE(3), and I need you to sit down for this one because she's deprecated 🫢


🚨 WARNING 🚨

Deprecated since version 1.14.0: Use bson_oid_init() instead.

not me having to tell you your fave is deprecated 😭 she served her time, she ate, but the girlies have moved on. please use bson_oid_init() instead, no cap.


✨ SYNOPSIS ✨

void
bson_oid_init_sequence (bson_oid_t *oid, bson_context_t *context);

that's it. that's the whole vibe check. πŸ’…


πŸŽ€ PARAMETERS πŸŽ€

  • oid β€” A bson_oid_t. this is the little cutie getting the glow-up, the main character of the operation πŸ‘‘
  • context β€” An optional bson_context_t. optional!! she can be there or she can be unbothered, your call 🌸

🌈 DESCRIPTION 🌈

So what does she actually do?? She generates a brand new ObjectID using the next 64-bit sequence number in context. πŸ¦‹

And the way she's built is so specific, like she's giving very structured:

  • the first 4 bytes contain the current time ⏰
  • the following 8 bytes contain the sequence number in big-endian format (iykyk) πŸ”₯

now here's the part you gotta hear, bestie, because it's lowkey important:

The bson_oid_t generated by this function is not guaranteed to be globally unique. She's only unique within this context. Periodt. πŸ’€

BUT β€” and this is the slay β€” she is guaranteed to be sequential. So like, not one-of-a-kind in the whole universe, but definitely in order. iconic behavior honestly ✨


πŸ‘‘ AUTHOR πŸ‘‘

MongoDB, Inc β€” the founders, the blueprint, the moment πŸ’œ


2009-present, MongoDB, Inc.


okay bestie that's the whole page, mwah πŸ’– this was page BSON_OID_INIT_SEQUENCE(3) from libbson, version 1.30.13, dated Oct 09, 2026 β€” and remember: she's deprecated, so go love on bson_oid_init() instead 🫢✨ bye bye!! πŸŽ€

πŸ“¦ where this page comes from