Add a delete operation to the bulk


(mongodb >=0.2.0)

MongoDB\Driver\BulkWrite::deleteAdd a delete operation to the bulk

Описание

public void MongoDB\Driver\BulkWrite::delete ( array|object $filter [, array $deleteOptions ] )

Список параметров

filter

The search filter.

deleteOptions

deleteOptions
Option Type Description Default
limit boolean Delete all matching documents (limit=0), or only the first matching document (limit=1) 0

Возвращаемые значения

Эта функция не возвращает значения после выполнения.

Ошибки

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

Примеры

Пример #1 MongoDB\Driver\BulkWrite::delete() example

<?php

$bulk 
= new MongoDB\Driver\BulkWrite(true);
$bulk->delete(array("tag" => "mongodb"), array("limit" => 1));
$bulk->delete(array("x" => "2"), array("limit" => 0));

$manager = new MongoDB\Driver\Manager("mongodb://localhost:27017");
$writeConcern = new MongoDB\Driver\WriteConcern(MongoDB\Driver\WriteConcern::MAJORITY1000);
$result $manager->executeBulkWrite("databaseName.collectionName"$bulk$writeConcern);

?>

Смотрите также