Differences Between: [Versions 310 and 311] [Versions 311 and 401] [Versions 39 and 311]
1 <?php 2 /* 3 * Copyright 2015-2017 MongoDB, Inc. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 namespace MongoDB\Operation; 19 20 use MongoDB\DeleteResult; 21 use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException; 22 use MongoDB\Driver\Server; 23 use MongoDB\Exception\InvalidArgumentException; 24 use MongoDB\Exception\UnsupportedException; 25 26 /** 27 * Operation for deleting multiple document with the delete command. 28 * 29 * @api 30 * @see \MongoDB\Collection::deleteOne() 31 * @see http://docs.mongodb.org/manual/reference/command/delete/ 32 */ 33 class DeleteMany implements Executable, Explainable 34 { 35 /** @var Delete */ 36 private $delete; 37 38 /** 39 * Constructs a delete command. 40 * 41 * Supported options: 42 * 43 * * collation (document): Collation specification. 44 * 45 * This is not supported for server versions < 3.4 and will result in an 46 * exception at execution time if used. 47 * 48 * * hint (string|document): The index to use. Specify either the index 49 * name as a string or the index key pattern as a document. If specified, 50 * then the query system will only consider plans using the hinted index. 51 * 52 * This is not supported for server versions < 4.4 and will result in an 53 * exception at execution time if used. 54 * 55 * * session (MongoDB\Driver\Session): Client session. 56 * 57 * Sessions are not supported for server versions < 3.6. 58 * 59 * * writeConcern (MongoDB\Driver\WriteConcern): Write concern. 60 * 61 * @param string $databaseName Database name 62 * @param string $collectionName Collection name 63 * @param array|object $filter Query by which to delete documents 64 * @param array $options Command options 65 * @throws InvalidArgumentException for parameter/option parsing errors 66 */ 67 public function __construct($databaseName, $collectionName, $filter, array $options = []) 68 { 69 $this->delete = new Delete($databaseName, $collectionName, $filter, 0, $options); 70 } 71 72 /** 73 * Execute the operation. 74 * 75 * @see Executable::execute() 76 * @param Server $server 77 * @return DeleteResult 78 * @throws UnsupportedException if collation is used and unsupported 79 * @throws DriverRuntimeException for other driver errors (e.g. connection errors) 80 */ 81 public function execute(Server $server) 82 { 83 return $this->delete->execute($server); 84 } 85 86 public function getCommandDocument(Server $server) 87 { 88 return $this->delete->getCommandDocument($server); 89 } 90 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body