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

# bson\_copy(3)

## SYNOPSIS

```
bson_t *
bson_copy (const bson_t *bson);
```

## PARAMETERS

- •

  **bson**: A *bson\_t*.

## DESCRIPTION

The *bson\_copy()* function shall copy the contents of a bson document into a new *bson\_t*.

The resulting *bson\_t* should be freed with *bson\_destroy()*.

## RETURNS

A newly allocated *bson\_t* that should be freed with *bson\_destroy()*.

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
