-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathjs-database.txt
230 lines (141 loc) · 7 KB
/
js-database.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
.. _docs-database-methods:
================
Database Methods
================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
.. include:: /includes/extracts/methods-toc-explanation.rst
.. list-table::
:widths: 30,70
:header-rows: 1
* - Name
- Description
* - :method:`db.adminCommand()`
- Runs a command against the ``admin`` database.
* - :method:`db.aggregate()`
- Runs admin/diagnostic pipeline which does not require an underlying collection.
* - :method:`db.commandHelp()`
- Returns help information for a :term:`database command`.
* - :method:`db.createCollection()`
- Creates a new collection or a view. Commonly used to create a capped collection.
* - :method:`db.createView()`
- Creates a view.
* - :method:`db.currentOp()`
- Reports the current in-progress operations.
* - :method:`db.dropDatabase()`
- Removes the current database.
* - :method:`db.fsyncLock()`
- Flushes writes to disk and locks the database to prevent write operations and assist backup operations. Wraps :dbcommand:`fsync`.
* - :method:`db.fsyncUnlock()`
- Allows writes to continue on a database locked with :method:`db.fsyncLock()`.
* - :method:`db.getCollection()`
- Returns a collection or view object. Used to access collections with names that are not valid in :binary:`~bin.mongosh`.
* - :method:`db.getCollectionInfos()`
- Returns collection information for all collections and views in the current database.
* - :method:`db.getCollectionNames()`
- Lists all collections and views in the current database.
* - :method:`db.getLogComponents()`
- Returns the log message verbosity levels.
* - :method:`db.getMongo()`
- Returns the :method:`Mongo()` connection object for the current connection.
* - :method:`db.getName()`
- Returns the name of the current database.
* - :method:`db.getProfilingStatus()`
- Returns a document that reflects the current profiling level and the profiling threshold.
* - :method:`db.getReplicationInfo()`
- Returns a document with replication statistics.
* - :method:`db.getSiblingDB()`
- Provides access to the specified database.
* - :method:`db.hello()`
- Returns a document that reports the state of the replica set.
* - :method:`db.help()`
- Displays descriptions of common ``db`` object methods.
* - :method:`db.hostInfo()`
- Returns a document with information about the system MongoDB runs on. Wraps :dbcommand:`hostInfo`
* - :method:`db.killOp()`
- Terminates a specified operation.
* - :method:`db.listCommands()`
- Displays a list of common database commands.
* - :method:`db.logout()`
- *Deprecated*. Ends an authenticated session.
* - :method:`db.printCollectionStats()`
- Prints statistics from every collection. Wraps :method:`db.collection.stats()`.
* - :method:`db.printReplicationInfo()`
- Prints a formatted report of the replica set status from
the perspective of the primary.
* - :method:`db.printSecondaryReplicationInfo()`
- Prints a formatted report of the replica set status from the
perspective of the secondaries.
* - :method:`db.printShardingStatus()`
- Prints a report of the sharding configuration and the chunk ranges.
* - :method:`db.rotateCertificates()`
- Performs online TLS certificate rotation. Wraps
:dbcommand:`rotateCertificates`.
* - :method:`db.runCommand()`
- Runs a :ref:`database command <database-commands>`.
* - :method:`db.serverBuildInfo()`
- Returns a document that displays the compilation parameters for the :binary:`~bin.mongod` instance. Wraps :dbcommand:`buildInfo`.
* - :method:`db.serverCmdLineOpts()`
- Returns a document with information about the runtime used to start the MongoDB instance. Wraps :dbcommand:`getCmdLineOpts`.
* - :method:`db.serverStatus()`
- Returns a document that provides an overview of the state of the database process.
* - :method:`db.setLogLevel()`
- Sets a single log message verbosity level.
* - :method:`db.setProfilingLevel()`
- Modifies the current level of database profiling.
* - :method:`db.shutdownServer()`
- Shuts down the current :binary:`~bin.mongod` or :binary:`~bin.mongos` process cleanly and safely.
* - :method:`db.stats()`
- Returns a document that reports on the state of the current database.
* - :method:`db.version()`
- Returns the version of the :binary:`~bin.mongod` instance.
* - :method:`db.watch()`
- Opens a :ref:`change stream cursor <changeStreams>` for a database
to report on all its non-``system`` collections. Cannot be opened on
the ``admin``, ``local`` or ``config`` databases.
.. toctree::
:titlesonly:
:hidden:
db.adminCommand </reference/method/db.adminCommand>
db.aggregate </reference/method/db.aggregate>
db.commandHelp </reference/method/db.commandHelp>
db.createCollection </reference/method/db.createCollection>
db.createView </reference/method/db.createView>
db.currentOp </reference/method/db.currentOp>
db.dropDatabase </reference/method/db.dropDatabase>
db.fsyncLock </reference/method/db.fsyncLock>
db.fsyncUnlock </reference/method/db.fsyncUnlock>
db.getCollection </reference/method/db.getCollection>
db.getCollectionInfos </reference/method/db.getCollectionInfos>
db.getCollectionNames </reference/method/db.getCollectionNames>
db.getLogComponents </reference/method/db.getLogComponents>
db.getMongo </reference/method/db.getMongo>
db.getName </reference/method/db.getName>
db.getProfilingStatus </reference/method/db.getProfilingStatus>
db.getReplicationInfo </reference/method/db.getReplicationInfo>
db.getSiblingDB </reference/method/db.getSiblingDB>
db.hello </reference/method/db.hello>
db.help </reference/method/db.help>
db.hostInfo </reference/method/db.hostInfo>
db.killOp </reference/method/db.killOp>
db.listCommands </reference/method/db.listCommands>
db.logout </reference/method/db.logout>
db.printCollectionStats </reference/method/db.printCollectionStats>
db.printReplicationInfo </reference/method/db.printReplicationInfo>
db.printSecondaryReplicationInfo </reference/method/db.printSecondaryReplicationInfo>
db.printShardingStatus </reference/method/db.printShardingStatus>
db.rotateCertificates </reference/method/db.rotateCertificates>
db.runCommand </reference/method/db.runCommand>
db.serverBuildInfo </reference/method/db.serverBuildInfo>
db.serverCmdLineOpts </reference/method/db.serverCmdLineOpts>
db.serverStatus </reference/method/db.serverStatus>
db.setLogLevel </reference/method/db.setLogLevel>
db.setProfilingLevel </reference/method/db.setProfilingLevel>
db.shutdownServer </reference/method/db.shutdownServer>
db.stats </reference/method/db.stats>
db.version </reference/method/db.version>
db.watch </reference/method/db.watch>