---
name: "mongoc_client_new"
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"
---

# mongoc\_client\_new(3)

## SYNOPSIS

```
mongoc_client_t *
mongoc_client_new (const char *uri_string);
```

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

## PARAMETERS

- •

  **uri\_string**: A string containing the MongoDB connection URI.

## 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 an error or warning will be logged.

**SEE ALSO:**

```
mongoc_client_new_from_uri()
```

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
