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