---
name: "mongoc_matcher_new"
section: "3"
platform: "linux"
package: "libmongoc-doc"
version: "1.23.1-1+deb12u3"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/mongoc_matcher_new"
---

# mongoc\_matcher\_new(3)

mongoc\_matcher\_new()

## NAME

mongoc\_matcher\_new - mongoc\_matcher\_new()

## SYNOPSIS

```
mongoc_matcher_t *
mongoc_matcher_new (const bson_t *query, bson_error_t *error)
   BSON_GNUC_WARN_UNUSED_RESULT BSON_GNUC_DEPRECATED;
```

Create a new *mongoc\_matcher\_t* using the query specification provided.

## DEPRECATED

**WARNING:**

**mongoc\_matcher\_t** is deprecated and will be removed in version 2.0.

## PARAMETERS

- •

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

- •

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

## ERRORS

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

## RETURNS

A newly allocated *mongoc\_matcher\_t* that should be freed with *mongoc\_matcher\_destroy()* when no longer in use. Upon failure, **NULL** is returned and **error** is set. This could happen if **query** contains an invalid query specification.

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2017-present, MongoDB, Inc
