BSON_APPEND_NOW_UTC(3)

πŸ’… BSON_APPEND_NOW_UTC(3) πŸ’…

okay so this is a page from the libbson manual (yes, that libbson, the BSON one, hi bestie 🫢) and it's literally about stamping the current UTC moment into your BSON document. tiny function, big main character energy ✨


✨ SYNOPSIS ✨

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

that's it. that's the whole signature. look at her go πŸŽ€


🌸 PARAMETERS 🌸

  • bson β€” a bson_t. the document bestie, the canvas, the whole vibe. πŸ’–
  • key β€” an ASCII C string holding the name of the field. name your child wisely πŸ¦‹
  • key_length β€” the length of key in bytes, or -1 if you want it to figure the length out with strlen(). the -1 is giving "i don't know her, you handle it" πŸ™ˆ

πŸ’œ DESCRIPTION πŸ’œ

so bson_append_now_utc() is your little helper function that goes and gets the current date and time in UTC β€” right now, this second, no cap β€” and appends it onto bson as a BSON_TYPE_DATE_TIME element. it's a timestamp, it's a mood, it's timeless (literally, it's UTC 😭).

under the hood, this function calls bson_append_date_time() internally. so it's not doing anything shady, it's just a cute little wrapper doing the delegation thing. iconic behavior honestly πŸ‘‘


⭐ RETURNS ⭐

returns true if the operation was applied successfully β€” slay, it worked πŸ’…

it will fail if appending the value grows bson larger than INT32_MAX. yeah. that limit is real and it's not playing around πŸ’€ so if your doc is already thicc, this append might be the straw that breaks it.


🧚 AUTHOR 🧚

MongoDB, Inc


2009-present, MongoDB, Inc.


aaaaand that's the whole page bestie, you ate that πŸ“πŸ’–

sign-off fr fr: this gorgeous piece of documentation is version 2.5.6, dated Oct 09, 2026, and it lives right here in section BSON_APPEND_NOW_UTC(3) of the libbson manual. go forth and timestamp responsibly πŸŒˆβ­πŸ’œ

πŸ“¦ where this page comes from