MONGOC_CLIENT_APPEND_METADATA(3)

πŸ“¦
version 2.5.6 Β· 2 versions
, in epel 10

πŸ’… MONGOC_CLIENT_APPEND_METADATA πŸ’…

okay bestie so this is a page out of the libmongoc manual, and honestly it's a little gem. it's called mongoc_client_append_metadata(3) and it's literally about making your driver introduce itself properly when it says hi to the server 🫢

✨ SYNOPSIS ✨

bool
mongoc_client_append_metadata (mongoc_client_t *client,
                               const char *name,
                               const char *version,
                               const char *platform)

πŸ’– DESCRIPTION πŸ’–

so what this does is append metadata to the handshake command β€” the one that gets sent as part of the initial connection handshake (that's the "hello" command, iykyk). it's giving "let me tell you who i am before we get into anything serious" πŸ’…

if you want the full lore, go look at mongoc_handshake_data_append() β€” that's where the details live.

one thing to note, and it's kind of the whole vibe: the updated handshake command applies only to the given client object, and only for connections that get established after the append took place. so no, it does not retroactively fix up connections you already had open. her main character era starts now, not earlier ✨

πŸŽ€ PARAMETERS πŸŽ€

  • client β€” A mongoc_client_t. literally the client you're doing this to πŸ’–
  • name β€” the name of the wrapping driver. Must not be null or an empty string β€” like, do not play with her, she needs an actual name πŸ™ˆ
  • version β€” the optional version of the wrapping driver. optional optional optional, no pressure bestie
  • platform β€” optional info about the current platform, for example configure options or compile flags. the "where do you even go to school" of handshake fields 🌸
⚠️ okay this is the important one: no string argument may contain the substring " / " β€” that's the delimiter used between metadata field values. so if your cute little platform string has / in it, that's a vibe check fail. do not pass go πŸ’€

πŸ”₯ RETURNS πŸ”₯

this function will log an error and return false when either of these happens:

  • client is from a mongoc_client_pool_t β€” in that case you need mongoc_client_pool_append_metadata() instead. wrong tool for the job, bestie, but it's an honest mistake 🫢
  • the resulting handshake document would exceed the size limit. she's too much. even for us.

otherwise it returns true if the given fields are set successfully. slay πŸ’…

πŸ‘‘ SEE ALSO

  • mongoc_client_pool_append_metadata()
  • mongoc_handshake_data_append()

🌈 AUTHOR 🌈

MongoDB, Inc β€” iconic, no notes.

2009-present, MongoDB, Inc. β€” that's the whole copyright line fr fr, respect the lineage πŸ‘‘


and that's the page!! written by the fine folks at MongoDB, Inc, from libmongoc 2.5.6, dated Oct 09, 2026 β€” go forth and introduce yourself to your servers properly πŸ’œβœ¨πŸŽ€

πŸ“¦ where this page comes from