BSON_APPEND_MINKEY(3)

πŸ’… BSON_APPEND_MINKEY(3) β€” the libbson one, bestie ✨

okay so picture this: a whole manual page, but make it make sense. it's BSON_APPEND_MINKEY(3) from libbson, and honestly? it's a tiny little icon and we're gonna get into it πŸŽ€


✨ SYNOPSIS ✨

like, here's the vibe, verbatim, no notes:

#define BSON_APPEND_MINKEY(b, key) \
   bson_append_minkey (b, key, (int) strlen (key))

bool
bson_append_minkey (bson_t *bson, const char *key, int key_length);

so there's the macro shortcut 🫢 and there's the real function doing the actual work. two for the price of one, we love to see it.


🌸 PARAMETERS 🌸

  • bson β€” a bson_t. that's the doc, the canvas, the main character πŸ’–
  • key β€” an ASCII C string holding the name of the field. so like, ASCII only, bestie, don't try anything fancy 😭
  • key_length β€” how many bytes long key is, or hit it with -1 and let it figure the length out with strlen(). convenient fr fr ✨

πŸ¦‹ DESCRIPTION πŸ¦‹

so bson_append_minkey() shall append an element of type BSON_TYPE_MINKEY to a bson document. that's the whole gig. no cap πŸ’…

where does this actually get used though? primarily in queries. and β€” important β€” it's unlikely to be used when storing a document to MongoDB. so like, if you're out here stuffing minkeys into documents you're saving, that's giving wrong-tool-for-the-job energy, just so you know πŸ™ˆ


πŸŽ€ RETURNS πŸŽ€

returns true if the operation was applied successfully πŸ‘‘ and the function will fail if appending the value grows bson larger than INT32_MAX. so watch the size, bestie, that's the line you do not cross πŸ’€


⭐ AUTHOR ⭐

MongoDB, Inc β€” the whole squad 🫢


2009-present, MongoDB, Inc. β€” iconic, long-running, respect the legacy πŸ’œ


and that's the tea πŸ“ this page was served up in version 2.5.6, dated Oct 09, 2026, under the libbson banner β€” love that for us, mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from