Skip to content

Commit ddceb6c

Browse files
(DOCSP-12177): Add command helpers
1 parent be3db7e commit ddceb6c

File tree

2 files changed

+67
-2
lines changed

2 files changed

+67
-2
lines changed

source/includes/steps-install-shell-macos.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ source:
2424
ref: add-shell-to-path
2525
ref: add-shell-to-path-macos
2626
---
27-
title: "Allow macOS to Run ``mongosh``."
27+
title: "Allow macOS to run ``mongosh``."
2828
ref: remove-quarantine-macos
2929
level: 4
3030
content: |

source/reference/access-mdb-shell-help.txt

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ Show Help for Specific Database Method
108108
The output resembles the following:
109109

110110
.. code-block:: none
111+
:copyable: false
111112

112113
db.adminCommand({ serverStatus: 1 }):
113114

@@ -218,7 +219,7 @@ Show Help for Specific Collection Method
218219
Show Additional Usage Details for a Collection Method
219220
To see additional usage details for a collection method in
220221
``mongosh``, type the ``db.<collection>.<method>`` name without the
221-
parenthesis (``()``) The following example returns
222+
parenthesis (``()``). The following example returns
222223
details about the :method:`~db.collection.insertOne()` method:
223224

224225
.. code-block:: javascript
@@ -291,3 +292,67 @@ the following commands:
291292
- ``ObjectId``
292293
- ``Symbol`` *(Deprecated)*
293294
- ``Timestamp``
295+
296+
Command Helpers
297+
---------------
298+
299+
``mongosh`` provides the following methods and commands to wrap
300+
certain database commands and obtain information on your deployment:
301+
302+
.. list-table::
303+
:header-rows: 1
304+
:widths: 30 70
305+
306+
* - Help Methods and Commands
307+
- Description
308+
309+
* - ``help``
310+
311+
- Show help.
312+
313+
* - :method:`db.help()`
314+
315+
- Show help for database methods.
316+
317+
* - :method:`db.\<collection\>.help() <db.collection.help>`
318+
319+
- Show help on collection methods. The ``<collection>`` can be the
320+
name of an existing collection or a non-existing collection.
321+
322+
* - ``show dbs``
323+
324+
- Print a list of all databases on the server.
325+
326+
.. note::
327+
328+
``show dbs`` is synonymous with ``show databases``.
329+
330+
* - ``use <db>``
331+
332+
- Switch current database to ``<db>``. The ``mongosh`` variable
333+
``db`` is set to the current database.
334+
335+
* - ``show collections``
336+
337+
- Print a list of all collections for current database
338+
339+
* - ``show users``
340+
341+
- Print a list of users for current database.
342+
343+
* - ``show roles``
344+
345+
- Print a list of all roles, both user-defined and built-in, for
346+
the current database.
347+
348+
* - ``show profile``
349+
350+
- Print the five most recent operations that took 1 millisecond or
351+
more. See documentation on the
352+
:manual:`database profiler
353+
</tutorial/manage-the-database-profiler>` for more information.d
354+
355+
* - ``load()``
356+
357+
- Execute a JavaScript file. See :doc:`/write-scripts` for more
358+
information.

0 commit comments

Comments
 (0)