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