mongoc_uri_new (3) Linux Manual Page
mongoc_uri_new() – Parses a string containing a MongoDB style URI connection string.
Synopsis
mongoc_uri_t * mongoc_uri_new (const char *uri_string) BSON_GNUC_WARN_UNUSED_RESULT;
Parameters
- uri_string
- A string containing a URI.
Description
Parses a string containing a MongoDB style URI connection string.
Returns
A newly allocated mongoc_uri_t if successful. Otherwise NULL \&.
NOTE
- 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 [at] localhost/
mongodb://kerberosuser%40EXAMPLE.COM [at] example.com/?authMechanism=GSSAPI
mongodb://[::1]:27017/
mongodb://10.0.0.1:27017,10.0.0.1:27018,[::1]:27019/?ssl=true
mongodb:///tmp/mongodb-27017.sock
mongodb://localhost,[::1]/mydb?authSource=mydb
Colophon
This page is part of MongoDB C Driver. Please report any bugs at https://jira.mongodb.org/browse/CDRIVER.
