1MONGOC_URI_GET_OPTION_AS_INT32(3) libmongoc MONGOC_URI_GET_OPTION_AS_INT32(3)
2
3
4
6 int32_t
7 mongoc_uri_get_option_as_int32 (const mongoc_uri_t *uri,
8 const char *option,
9 int32_t fallback);
10
12 • uri: A mongoc_uri_t.
13
14 • option: The name of an option, case insensitive.
15
16 • fallback: A default value to return.
17
19 Returns the value of the URI option if it is set and of the correct
20 type (integer). Returns fallback if the option is not set, set to an
21 invalid type, or zero.
22
23 Zero is considered "unset", so URIs can be constructed like so, and
24 still accept default values:
25
26 bson_strdup_printf ("mongodb://localhost/?connectTimeoutMS=%d", myvalue)
27
28 If myvalue is non-zero it is the connection timeout; if it is zero the
29 driver uses the default timeout.
30
31 When reading an option that is an int64, this function will return the
32 value as int32_t. If the value is outside the range of a 32-bit inte‐
33 ger, a warning will be emitted and fallback is returned instead.
34
35 SEE ALSO:
36 mongoc_uri_get_option_as_int64()
37
38
40 MongoDB, Inc
41
43 2017-present, MongoDB, Inc
44
45
46
47
481.25.1 Nov 08, 2023MONGOC_URI_GET_OPTION_AS_INT32(3)