---
name: "bson_iter_as_bool"
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_iter_as_bool"
---

# bson\_iter\_as\_bool(3)

## SYNOPSIS

```
bool
bson_iter_as_bool (const bson_iter_t *iter);
```

## PARAMETERS

- •

  **iter**: A *bson\_iter\_t*.

## DESCRIPTION

Fetches the current field as if it were a boolean.

**bson\_iter\_as\_bool()** currently knows how to determine a boolean value from the following types:

- •

  BSON\_TYPE\_BOOL

- •

  BSON\_TYPE\_DOUBLE

- •

  BSON\_TYPE\_INT32

- •

  BSON\_TYPE\_INT64

- •

  BSON\_TYPE\_NULL

- •

  BSON\_TYPE\_UNDEFINED

- •

  BSON\_TYPE\_UTF8

BSON\_TYPE\_UTF8 will always equate to **true**.

## RETURNS

true if the field equates to non-zero.

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
