BSON_APPEND_DBPOINTER(3)
π BSON_APPEND_DBPOINTER β¨
okay bestie so this one lives in libbson (that's the BSON_APPEND_DBPOINTER(3) situation, iykyk) and it's your girl for appending a dbpointer field to a BSON document. it's giving very niche, very legacy, but she ate π
πΈ SYNOPSIS πΈ
here's the whole vibe, both forms, copy-paste approved:
#define BSON_APPEND_DBPOINTER(b, key, coll, oid) \
bson_append_dbpointer (b, key, (int) strlen (key), coll, oid)
bool
bson_append_dbpointer (bson_t *bson,
const char *key,
int key_length,
const char *collection,
const bson_oid_t *oid);
so the macro is the lazy-girl route (it does the strlen for you, iconic) and the function is the full-control route π
π¦ PARAMETERS π¦
bsonβ abson_t. that's your document, your main character, the thing you're appending to β¨keyβ an ASCII C string with the name of the field. just ASCII, bestie, don't get fancy πkey_lengthβ the length ofkeyin bytes, or-1to let it figure the length out withstrlen(). the-1is literally the "you handle it" option and we respect it πcollectionβ the target collection name πΈoidβ the target document identifier. it's aconst bson_oid_t *, so a pointer, don't forget the&π«Ά
β DESCRIPTION β
okay so this appends a dbpointer field to your bson_t. simple. clean. done.
β οΈ WARNING, and I need you to actually read this one, bestie: the dbpointer field type is DEPRECATED π and should only be used when interacting with legacy systems. like, legacy legacy. if you're out here choosing dbpointer for a fresh new project, what are you doing π
π₯ RETURNS π₯
returns true if the operation was applied successfully β slay π
but ngl, the function will fail if appending the array grows bson larger than INT32_MAX. that's the limit, that's the ceiling, no cap π§
π AUTHOR π
MongoDB, Inc β the ones who wrote it, the ones to thank π
π COPYRIGHT π
2009-present, MongoDB, Inc. β all the legal sparkle, preserved exactly β¨
that's the whole page, bestie, every flag and caveat intact and nothing invented, fr fr π«Ά stay safe out there and remember: dbpointer is legacy only, periodt π
β with love from libbson 2.5.6, dated Oct 09, 2026 ππ¦β
π¦ where this page comes from
- epel 10: libbson-devel 2.5.6-1.el10_3 Β· Apache-2.0 AND ISC AND MIT AND Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms