MongoDB\Driver\BulkWriteCommand::deleteOne
PHP function
Edit on GitHub ✎
(mongodb >=2.1.0)
Add a deleteOne operation
Description
MongoDB\Driver\BulkWriteCommand::deleteOne(string $namespace, array|object $filter, array|null $options = null): void
Add a deleteOne operation to the MongoDB\Driver\BulkWriteCommand. The first document matching filter in the collection identified by namespace will be deleted.
Parameters
optionsOption Type Description Default hint string|array|objectIndex specification. Specify either the index name as a string or the index key pattern. If specified, then the query system will only consider plans using the hinted index.
Return Values
Void
Errors/Exceptions
Examples
MongoDB\Driver\BulkWriteCommand::deleteOne() example
php
<?php
$manager = new MongoDB\Driver\Manager;
$bulk = new MongoDB\Driver\BulkWriteCommand;
$bulk->deleteOne('db.coll', ['x' => 1]);
$result = $manager->executeBulkWriteCommand($bulk);
?>See Also
MongoDB\Driver\BulkWriteCommand::deleteManyMongoDB\Driver\Manager::executeBulkWriteCommandMongoDB\Driver\BulkWriteCommandResult