---
name: "mongoc_cursor_clone"
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_cursor_clone"
---

# mongoc\_cursor\_clone(3)

## SYNOPSIS

```
mongoc_cursor_t *
mongoc_cursor_clone (const mongoc_cursor_t *cursor);
```

## PARAMETERS

- •

  **cursor**: A *mongoc\_cursor\_t*.

## DESCRIPTION

This function shall create a copy of a *mongoc\_cursor\_t*. The cloned cursor will be reset to the beginning of the query, and therefore the query will be re-executed on the MongoDB server when *mongoc\_cursor\_next()* is called.

## RETURNS

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

**WARNING:**

Failure to handle the result of this function is a programming error.

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
