You are here

public function KeyvalueMongodb::has in MongoDB 8

Returns whether a given key exists in the store.

Parameters

string $key: The key to check.

Return value

bool TRUE if the key exists, FALSE otherwise.

Overrides KeyValueStoreInterface::has

File

src/KeyvalueMongodb.php, line 233

Class

KeyvalueMongodb
This class holds a MongoDB key-value backend.

Namespace

Drupal\mongodb

Code

public function has($key) {
  return (bool) $this
    ->collection()
    ->findOne(array(
    '_id' => (string) $key,
  ));
}