---
name: "bson_writer_begin"
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_writer_begin"
---

# bson\_writer\_begin(3)

## SYNOPSIS

```
bool
bson_writer_begin (bson_writer_t *writer, bson_t **bson);
```

## PARAMETERS

- •

  **writer**: A *bson\_writer\_t*.

- •

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

## DESCRIPTION

Begins writing a new document. The caller may use the bson structure to write out a new BSON document. When completed, the caller must call either *bson\_writer\_end()* or *bson\_writer\_rollback()*.

## RETURNS

true if there was space in the underlying buffers to begin the document.

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
