mongoc_uri_new_with_error(3)

mongoc_uri_new_with_error3

Usage

mongoc_uri_t *
mongoc_uri_new_with_error (const char *uri_string,
                           bson_error_t *error);

Parameters

•

uri_string: A string containing a URI.

•

error: An optional location for a bson_error_t or NULL.

Overview

Parses a string containing a MongoDB style URI connection string.

Returns

A newly allocated mongoc_uri_t if successful. Otherwise NULL populating error with the error description.

WARNING:

Failure to handle the result of this function is a programming error.

Examples

Examples of some valid MongoDB connection strings can be seen below.

"mongodb://localhost/"

"mongodb://localhost/?replicaSet=myreplset"

"mongodb://myuser:mypass@localhost/"

"mongodb://kerberosuser%[email protected]/?authMechanism=GSSAPI"

"mongodb://[::1]:27017/"

"mongodb://10.0.0.1:27017,10.0.0.1:27018,[::1]:27019/?tls=true"

"mongodb://%2Ftmp%2Fmongodb-27017.sock"

"mongodb://user:pass@%2Ftmp%2Fmongodb-27017.sock"

"mongodb://localhost,[::1]/mydb?authSource=mydb"

Releases

4 releases since Debian 10 (Buster); the text changed 3 times.

  1. 10
  2. 11
  3. 12
  4. 13

Author

MongoDB, Inc

From libmongoc-doc 1.30.4-1+deb13u3 in Debian 13 (Trixie). Parsed by carta from the page's man source.