---
name: "bson_string_new"
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_string_new"
---

# bson\_string\_new(3)

**WARNING:**

Deprecated since version 1.29.0.

## SYNOPSIS

```
bson_string_t *
bson_string_new (const char *str);
```

## PARAMETERS

- •

  **str**: A string to be copied or NULL.

## DESCRIPTION

Creates a new string builder, which uses power-of-two growth of buffers. Use the various bson\_string\_append\*() functions to append to the string.

**WARNING:**

The length of the resulting string (including the **NULL** terminator) MUST NOT exceed **UINT32\_MAX**.

## RETURNS

A newly allocated bson\_string\_t that should be freed with bson\_string\_free() when no longer in use.

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
