MONGOC_URI_SET_AUTH_SOURCE(3)

πŸ’… MONGOC_URI_SET_AUTH_SOURCE(3) πŸ’…

okay so bestie, this is a page from libmongoc β€” yes, the MONGOC_URI_SET_AUTH_SOURCE(3) one, you found it, slay β€” and it's literally just about setting one little URI option after the fact. tiny page, big "authSource" energy. let's go πŸŽ€


✨ SYNOPSIS ✨

bool
mongoc_uri_set_auth_source (mongoc_uri_t *uri, const char *value);

that's the whole vibe. one function, two args, returns a bool. iconic honestly 🌸


🫢 PARAMETERS 🫢

  • uri β€” a mongoc_uri_t. like, the URI object you're messing with. that one. πŸ’–
  • value β€” the new "authSource" value. the fresh one you want in there instead of whatever's there now.

πŸ¦‹ DESCRIPTION πŸ¦‹

so this function sets the "authSource" URI option β€” but here's the thing: it does it after the URI has already been parsed from a string. so you've got your URI, it's parsed, it's living its life, and now you want to swap the auth source. this is the girl for that job ✨

and the way it works is lowkey satisfying: if the option is already set, it gets updated in-place (no extra copy, no drama). if it's not set yet, it just gets appended to the URI's bson_t of options. either way you're covered πŸ’…


πŸ”₯ RETURNS πŸ”₯

it returns false if the option cannot be set β€” for example, if value is not valid UTF-8. 😭 so yeah, feed it real UTF-8 or it's gonna say no. otherwise you're good.

ngl, check that return value. it's giving "I tried my best" when it returns false, and you deserve to know. πŸ™ˆ

πŸ‘‘ AUTHOR πŸ‘‘

MongoDB, Inc


2009-present, MongoDB, Inc.


okay that's the whole page, periodt. πŸ’œ this was libmongoc 2.5.6, dated Oct 09, 2026 β€” go forth and set those auth sources, bestie, you're gonna ate πŸ¦‹βœ¨πŸŽ€

πŸ“¦ where this page comes from