---
name: "mongoc_bulk_operation_replace_one"
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_bulk_operation_replace_one"
---

# mongoc\_bulk\_operation\_replace\_one(3)

## SYNOPSIS

```
void
mongoc_bulk_operation_replace_one (mongoc_bulk_operation_t *bulk,
                                   const bson_t *selector,
                                   const bson_t *document,
                                   bool upsert);
```

Replace a single document as part of a bulk operation. This only queues the operation. To execute it, call *mongoc\_bulk\_operation\_execute()*.

This function is superseded by *mongoc\_bulk\_operation\_replace\_one\_with\_opts()*.

## PARAMETERS

- •

  **bulk**: A *mongoc\_bulk\_operation\_t*.

- •

  **selector**: A *bson\_t* that selects which document to remove.

- •

  **document**: A *bson\_t* containing the replacement document.

- •

  **upsert**: **true** if this should be an **upsert**.

**WARNING:**

**document** may not contain fields with keys containing **.** or **$**.

## ERRORS

Errors are propagated via *mongoc\_bulk\_operation\_execute()*.

**SEE ALSO:**

```
mongoc_bulk_operation_replace_one_with_opts()
```

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
