©
本文档使用
php.cn手册 发布
(mongodb >=1.0.0)
MongoDB\Driver\BulkWrite::delete — Add a delete operation to the bulk
$filter
[, array $deleteOptions
] )Adds a delete operation to the MongoDB\Driver\BulkWrite.
filter
( array|object )The search filter.
deleteOptions
Option | Type | Description | Default |
---|---|---|---|
limit | bool | Delete all matching documents (limit=0), or only the first matching document (limit=1) | FALSE |
没有返回值。
Example #1 MongoDB\Driver\BulkWrite::delete() example
<?php
$bulk = new MongoDB \ Driver \ BulkWrite ;
$bulk -> delete ([ 'x' => 1 ], [ 'limit' => 1 ]);
$bulk -> delete ([ 'x' => 2 ], [ 'limit' => 0 ]);
$manager = new MongoDB \ Driver \ Manager ( 'mongodb://localhost:27017' );
$writeConcern = new MongoDB \ Driver \ WriteConcern ( MongoDB \ Driver \ WriteConcern :: MAJORITY , 1000 );
$result = $manager -> executeBulkWrite ( 'db.collection' , $bulk , $writeConcern );
?>