See Release Notes
Long Term Support Release
Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401]
1 <?php 2 /* 3 * Copyright 2015-present 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 * https://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\Command\ListDatabases as ListDatabasesCommand; 21 use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException; 22 use MongoDB\Driver\Server; 23 use MongoDB\Exception\InvalidArgumentException; 24 use MongoDB\Exception\UnexpectedValueException; 25 use MongoDB\Model\DatabaseInfoIterator; 26 use MongoDB\Model\DatabaseInfoLegacyIterator; 27 28 /** 29 * Operation for the ListDatabases command. 30 * 31 * @api 32 * @see \MongoDB\Client::listDatabases() 33 * @see https://mongodb.com/docs/manual/reference/command/listDatabases/#mongodb-dbcommand-dbcmd.listDatabases` 34 */ 35 class ListDatabases implements Executable 36 { 37 /** @var ListDatabasesCommand */ 38 private $listDatabases; 39 40 /** 41 * Constructs a listDatabases command. 42 * 43 * Supported options: 44 * 45 * * authorizedDatabases (boolean): Determines which databases are returned 46 * based on the user privileges. 47 * 48 * For servers < 4.0.5, this option is ignored. 49 * 50 * * comment (mixed): BSON value to attach as a comment to this command. 51 * 52 * This is not supported for servers versions < 4.4. 53 * 54 * * filter (document): Query by which to filter databases. 55 * 56 * * maxTimeMS (integer): The maximum amount of time to allow the query to 57 * run. 58 * 59 * * session (MongoDB\Driver\Session): Client session. 60 * 61 * @param array $options Command options 62 * @throws InvalidArgumentException for parameter/option parsing errors 63 */ 64 public function __construct(array $options = []) 65 { 66 $this->listDatabases = new ListDatabasesCommand(['nameOnly' => false] + $options); 67 } 68 69 /** 70 * Execute the operation. 71 * 72 * @see Executable::execute() 73 * @return DatabaseInfoIterator 74 * @throws UnexpectedValueException if the command response was malformed 75 * @throws DriverRuntimeException for other driver errors (e.g. connection errors) 76 */ 77 public function execute(Server $server) 78 { 79 return new DatabaseInfoLegacyIterator($this->listDatabases->execute($server)); 80 } 81 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body