-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathMongoDBClient-dropDatabase.txt
91 lines (61 loc) · 2.06 KB
/
MongoDBClient-dropDatabase.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
===============================
MongoDB\\Client::dropDatabase()
===============================
.. meta::
:description: Drop a database on the server with options for comments, sessions, type maps, and write concerns with the MongoDB PHP Library.
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. phpmethod:: MongoDB\Client::dropDatabase()
Drop a database on the server.
.. code-block:: php
function dropDatabase(string $databaseName, array $options = []): void
Parameters
----------
``$databaseName`` : string
The name of the database to drop.
``$options`` : array
An array specifying the desired options.
.. list-table::
:header-rows: 1
:widths: 20 20 80
* - Name
- Type
- Description
* - comment
- mixed
- .. include:: /includes/extracts/common-option-comment.rst
.. include:: /includes/extracts/option-requires-4.4.rst
.. versionadded:: 1.13
* - session
- :php:`MongoDB\Driver\Session <class.mongodb-driver-session>`
- .. include:: /includes/extracts/common-option-session.rst
.. versionadded:: 1.3
* - typeMap
- array
- .. include:: /includes/extracts/client-option-typeMap.rst
This will be used for the returned command result document.
* - writeConcern
- :php:`MongoDB\Driver\WriteConcern <class.mongodb-driver-writeconcern>`
- .. include:: /includes/extracts/client-option-writeConcern.rst
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unsupportedexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Example
-------
The following example drops the ``test`` database:
.. code-block:: php
<?php
$client = new MongoDB\Client;
$client->dropDatabase('test');
See Also
--------
- :phpmethod:`MongoDB\Database::drop()`
- :manual:`dropDatabase </reference/command/dropDatabase>` command reference in
the MongoDB manual