---
name: "mongoc_client_new_from_uri_with_error"
section: "3"
platform: "linux"
package: "libmongoc-doc"
version: "1.30.4-1+deb13u3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/mongoc_client_new_from_uri_with_error"
---

# mongoc\_client\_new\_from\_uri\_with\_error(3)

## SYNOPSIS

```
mongoc_client_t *
mongoc_client_new_from_uri_with_error (const mongoc_uri_t *uri,
                                       bson_error_t *error);
```

Creates a new *mongoc\_client\_t* using the *mongoc\_uri\_t* provided.

## PARAMETERS

- •

  **uri**: A *mongoc\_uri\_t*.

- •

  **error**: An optional location for a *bson\_error\_t* or **NULL**.

## RETURNS

A newly allocated *mongoc\_client\_t* that should be freed with *mongoc\_client\_destroy()* when no longer in use. On error, **NULL** is returned and **error** will be populated with the error description.

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
