1MONGOC_URI_NEW_WITH_ERROR(3) libmongoc MONGOC_URI_NEW_WITH_ERROR(3)
2
3
4
6 mongoc_uri_t *
7 mongoc_uri_new_with_error (const char *uri_string,
8 bson_error_t *error) BSON_GNUC_WARN_UNUSED_RESULT;
9
11 • uri_string: A string containing a URI.
12
13 • error: An optional location for a bson_error_t or NULL.
14
16 Parses a string containing a MongoDB style URI connection string.
17
19 A newly allocated mongoc_uri_t if successful. Otherwise NULL populating
20 error with the error description.
21
22 WARNING:
23 Failure to handle the result of this function is a programming er‐
24 ror.
25
27 Examples of some valid MongoDB connection strings can be seen below.
28
29 "mongodb://localhost/"
30
31 "mongodb://localhost/?replicaSet=myreplset"
32
33 "mongodb://myuser:mypass@localhost/"
34
35 "mongodb://kerberosuser%40EXAMPLE.COM@example.com/?authMechanism=GSS‐
36 API"
37
38 "mongodb://[::1]:27017/"
39
40 "mongodb://10.0.0.1:27017,10.0.0.1:27018,[::1]:27019/?tls=true"
41
42 "mongodb://%2Ftmp%2Fmongodb-27017.sock"
43
44 "mongodb://user:pass@%2Ftmp%2Fmongodb-27017.sock"
45
46 "mongodb://localhost,[::1]/mydb?authSource=mydb"
47
49 MongoDB, Inc
50
52 2017-present, MongoDB, Inc
53
54
55
56
571.25.1 Nov 08, 2023 MONGOC_URI_NEW_WITH_ERROR(3)