---
name: "bson_oid_is_valid"
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_oid_is_valid"
---

# bson\_oid\_is\_valid(3)

## SYNOPSIS

```
bool
bson_oid_is_valid (const char *str, size_t length);
```

## PARAMETERS

- •

  **str**: A string.

- •

  **length**: The length of **str**.

## DESCRIPTION

Checks if a string containing a hex encoded string is a valid BSON ObjectID.

## RETURNS

true if **str** could be parsed.

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
