---
name: "mongoc_database_copy"
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_database_copy"
---

# mongoc\_database\_copy(3)

## SYNOPSIS

```
mongoc_database_t *
mongoc_database_copy (mongoc_database_t *database);
```

## PARAMETERS

- •

  **database**: A *mongoc\_database\_t*.

## DESCRIPTION

Performs a deep copy of the **database** struct and its configuration. Useful if you intend to call *mongoc\_database\_set\_write\_concern()*, *mongoc\_database\_set\_read\_prefs()*, or *mongoc\_database\_set\_read\_concern()*, and want to preserve an unaltered copy of the struct.

## RETURNS

A newly allocated *mongoc\_database\_t* that should be freed with *mongoc\_database\_destroy()* when no longer in use.

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
