public function MongodbConfigStorage::deleteAll in MongoDB 8
Deletes configuration objects whose names start with a given prefix.
Given the following configuration object names:
- node.type.article
- node.type.page
Passing the prefix 'node.type.' will delete the above configuration objects.
Parameters
string $prefix: (optional) The prefix to search for. If omitted, all configuration objects that exist will be deleted.
Return value
bool TRUE on success, FALSE otherwise.
Overrides StorageInterface::deleteAll
File
- src/
MongodbConfigStorage.php, line 173 - Definition of Drupal\mongodb\Config\MongoStorage.
Class
Namespace
Drupal\mongodbCode
public function deleteAll($prefix = '') {
$condition = array();
if (!empty($prefix)) {
$condition = array(
'_id' => new \MongoRegex('/^' . str_replace('.', '\\.', $prefix) . '/'),
);
}
try {
$this
->mongoCollection()
->remove($condition);
} catch (\Exception $e) {
return FALSE;
}
return TRUE;
}