MONGOC_URI_SE...ISM_PROPERTIES(3)
π MONGOC_URI_SE...ISM_PROPERTIES(3) β¨
okay so bestie, welcome to libmongoc β yes the man page title is literally cut off (MONGOC_URI_SE...ISM_PROPERTIES(3), iconic abbreviation energy), but the whole point of this one is that long-ish function mongoc_uri_set_mechanism_properties. it's giving "short name, big job" and honestly? we respect it π«Ά
πΈ SYNOPSIS πΈ
like, here's the shape of it, no cap:
bool
mongoc_uri_set_mechanism_properties (mongoc_uri_t *uri,
const bson_t *properties);
π PARAMETERS π
- uri β a
mongoc_uri_t. your URI. your main character. - properties β a
bson_t. this is the BSON blob holding the new stuff.
π¦ DESCRIPTION π¦
so here's the tea β: this function replaces all the options in the URI's "authMechanismProperties" β and it does it after the URI has already been parsed from a string. it's not adding, it's not merging, it's full-on replacing the whole set. periodt π
β RETURNS β
it hands back false if the option can't be set β for example, if properties is not valid BSON data. so like, do a vibe check on your BSON first, bestie π
π EXAMPLE π
here's the whole thing in action, copy it exactly, i'm not even kidding:
mongoc_uri_t *uri;
bson_t props = BSON_INITIALIZER;
uri = mongoc_uri_new (
"mongodb://user%40DOMAIN.COM:password@localhost/?authMechanism=GSSAPI"
"&authMechanismProperties=SERVICE_NAME:other,CANONICALIZE_HOST_NAME:true");
/* replace all options: replace service name "other" with "my_service", unset
* "CANONICALIZE_HOST_NAME" and accept its default.
*/
BSON_APPEND_UTF8 (&props, "SERVICE_NAME", "my_service");
mongoc_uri_set_mechanism_properties (uri, &props);
bson_destroy (&props);
so what's happening here? the comment in the code says it all, but lemme hype it up anyway π β we swap the service name "other" for "my_service", we unset "CANONICALIZE_HOST_NAME" and just accept its default. because that's literally what "replaces all the options" means. it ate and left no crumbs π
π AUTHOR π
MongoDB, Inc β the icons behind all this π«‘
π§ COPYRIGHT π§
2009-present, MongoDB, Inc.
and that's the whole page, bestie π hope your mechanism properties are always valid BSON and your return value is always true. stay slay β¨
β signed off with love from libmongoc version 2.5.6, dated Oct 09, 2026 ππΈπ¦
π¦ where this page comes from
- epel 10: mongo-c-driver-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