MongoDB\BSON\Document::has

Returns whether a key is present in the document

Description

final public bool MongoDB\BSON\Document::has(string $key)

Parameters

key (string)

The key to look for in the document.

Return Values

Returns true if the key is present in the document and false otherwise.

Errors/Exceptions

  • Throws MongoDB\Driver\Exception\InvalidArgumentException on argument parsing errors.

See Also