---
name: "mongoc_client_get_gridfs"
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_client_get_gridfs"
---

# mongoc\_client\_get\_gridfs(3)

## SYNOPSIS

```
mongoc_gridfs_t *
mongoc_client_get_gridfs (mongoc_client_t *client,
                          const char *db,
                          const char *prefix,
                          bson_error_t *error);
```

The **mongoc\_client\_get\_gridfs()** function shall create a new *mongoc\_gridfs\_t*. The **db** parameter is the name of the database which the gridfs instance should exist in. The **prefix** parameter corresponds to the gridfs collection namespacing; its default is "fs", thus the default GridFS collection names are "fs.files" and "fs.chunks".

## PARAMETERS

- •

  **client**: A *mongoc\_client\_t*.

- •

  **db**: The database name.

- •

  **prefix**: Optional prefix for gridfs collection names or **NULL**.

- •

  **error**: An optional location for a *bson\_error\_t* or **NULL**.

## ERRORS

Errors are propagated via the **error** parameter.

## RETURNS

On success, returns a *mongoc\_gridfs\_t* you must free with *mongoc\_gridfs\_destroy()*. Returns **NULL** upon failure and sets **error**.

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
