Skip to content

Commit 831b39e

Browse files
(DOCSP-12243): Add Run Commands page and some command behaviors (#49)
* (DOCSP-12243): Add Run Commands page and some command behaviors WIP * Updates per feedback * tweaks * copy tweak * formatting fix
1 parent e5945ff commit 831b39e

File tree

5 files changed

+67
-11
lines changed

5 files changed

+67
-11
lines changed

snooty.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title = "MongoDB Shell"
33

44
intersphinx = ["https://docs.mongodb.com/manual/objects.inv"]
55

6-
toc_landing_pages = ["/crud"]
6+
toc_landing_pages = ["/run-commands", "/crud"]
77

88
[constants]
99

source/changelog.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. _mongosh-changelog
1+
.. _mongosh-changelog:
22

33
=====================
44
``mongosh`` Changelog
@@ -58,11 +58,12 @@ the `MongoDB Download Center
5858
Behavior Updates
5959
~~~~~~~~~~~~~~~~
6060

61-
The legacy ``mongo`` shell error handling was not consistent between
62-
commands. ``mongosh`` now standardizes the user-facing behavior.
63-
Whenever a shell helper issues a command that results in ``{ ok: 0 }``
64-
``mongosh`` throws an exception and does not return the raw output from
65-
the server.
61+
Whenever a command's output includes ``{ ok: 0 }``, ``mongosh`` throws
62+
an exception and does not return the raw output from the server.
63+
64+
The legacy ``mongo`` shell error handling is not consistent between
65+
commands. ``mongosh`` standardizes the user-facing behavior for a
66+
more consistent experience.
6667

6768
Bug Fixes
6869
~~~~~~~~~
@@ -87,7 +88,7 @@ Bug Fixes
8788
.. note::
8889

8990
``Ctrl+C`` terminates the process in the shell, but does not
90-
terminate the process on the mongodb server.
91+
terminate the process on the MongoDB server.
9192

9293
v0.2.2
9394
------

source/index.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ Learn More
119119

120120
/install
121121
/connect
122-
/crud
123-
/run-agg-pipelines
122+
/run-commands
124123
/write-scripts
125124
/logs
126125
/reference

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ Show List of Databases
5656

5757
show dbs
5858

59-
``show databases`` is an alias for ``show dbs``.
59+
.. note::
60+
61+
``show databases`` is an alias for ``show dbs``.
6062

6163
Show List of Database Methods
6264
To see the list of methods you can use on the ``db``

source/run-commands.txt

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
.. _run-commands:
2+
3+
===========================
4+
Run Commands in ``mongosh``
5+
===========================
6+
7+
.. default-domain:: mongodb
8+
9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 1
13+
:class: singlecol
14+
15+
.. include:: /includes/admonitions/fact-mdb-shell-beta.rst
16+
17+
For documentation of basic MongoDB operations in ``mongosh``, see:
18+
19+
- :doc:`/crud`
20+
21+
- :doc:`/run-agg-pipelines`
22+
23+
- :doc:`/reference/methods`
24+
25+
Terminate a Running Command
26+
---------------------------
27+
28+
To terminate a running command or query in ``mongosh``,
29+
press ``Ctrl + C``.
30+
31+
``Ctrl + C`` terminates the process in the shell, but does not
32+
terminate the process on the MongoDB server. This behavior
33+
differs from the :method:`db.killOp()` method, which terminates
34+
commands on the server.
35+
36+
Command Exceptions
37+
------------------
38+
39+
In scenarios where the output of a command includes ``{ ok: 0 }``,
40+
``mongosh`` throws an exception and does not return the raw output from
41+
the server.
42+
43+
.. note::
44+
45+
In the legacy ``mongo`` shell, when a command's output included ``{
46+
ok: 0 }``, the behavior differs between commands. ``mongosh``
47+
provides consistent behavior by always throwing an exception in these
48+
scenarios.
49+
50+
.. toctree::
51+
:titlesonly:
52+
53+
/crud
54+
/run-agg-pipelines

0 commit comments

Comments
 (0)