MONGOC_URI_GET_OPTION_AS_INT64(3)
π MONGOC_URI_GET_OPTION_AS_INT64 π
okay bestie so this one lives in the libmongoc manual, and it's literally the easiest little guy ever: you hand it a URI, you hand it an option name, and it hands you back a number. That's it. That's the whole vibe. β¨
πΈ SYNOPSIS πΈ
int64_t
mongoc_uri_get_option_as_int64 (const mongoc_uri_t *uri,
const char *option,
int64_t fallback);
π PARAMETERS π
uriβ Amongoc_uri_t. your lil URI object, the main character of the whole operation π«Άoptionβ The name of an option, case insensitive. so like, don't stress about caps, she doesn't care πfallbackβ A default value to return. the safety net, the backup plan, the "if everything else fails, at least you have this" bestie π
π¦ DESCRIPTION π¦
So here's the tea: this function returns the value of the URI option if it's set and it's the correct type (integer, ngl). And it returns fallback if the option is not set, if it's set to an invalid type, or if it's zero. All three of those situations? Straight to fallback. no cap.
β οΈ and this is the important one, bestie: zero is considered "unset". yeah. zero counts as nothing. so if you actually want zero you're out of luck here, she's gonna give you the fallback instead π
Which honestly lowkey slaps, because it means you can construct URIs like this and they'll still accept the default values:
bson_strdup_printf ("mongodb://localhost/?wTimeoutMS=%" PRId64, myvalue)
So if myvalue is non-zero, that's your write concern timeout. but if myvalue is zero, the driver just uses the default timeout. iconic behaviour honestly. it's giving "idk just pick for me" π§
π SEE ALSO π
mongoc_uri_get_option_as_int32()β the 32-bit sibling, same energy, smaller numbers π
π AUTHOR π
MongoDB, Inc β the whole entire company, yes, all of them π
β COPYRIGHT β
2009-present, MongoDB, Inc. β and honestly? goals. a copyright span of over a decade and a half. periodt. π
okay that's the page!! if you made it this far ily π this is from libmongoc 2.5.6, dated Oct 09, 2026 β so like, go forth and read your int64s responsibly bestie β¨π¦π
π¦ 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