You are here

public function MongodbConfigStorage::delete in MongoDB 8

Deletes a configuration object from the storage.

Parameters

string $name: The name of a configuration object to delete.

Return value

bool TRUE on success, FALSE otherwise.

Overrides StorageInterface::delete

File

src/MongodbConfigStorage.php, line 99
Definition of Drupal\mongodb\Config\MongoStorage.

Class

MongodbConfigStorage

Namespace

Drupal\mongodb

Code

public function delete($name) {
  try {
    $result = $this
      ->mongoCollection()
      ->remove(array(
      '_id' => $name,
    ));
  } catch (\Exception $e) {
    return FALSE;
  }
  return $result['n'] == 0 ? FALSE : TRUE;
}