---
name: "bson_has_field"
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_has_field"
---

# bson\_has\_field(3)

## SYNOPSIS

```
bool
bson_has_field (const bson_t *bson, const char *key);
```

## PARAMETERS

- •

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

- •

  **key**: A string containing the name of the field to check for.

## DESCRIPTION

Checks to see if key contains an element named **key**. This also accepts "dotkey" notation such as "a.b.c.d".

## RETURNS

true if **key** was found within **bson**; otherwise false.

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
