1+ .. _mdb-shell-overview:
2+
13=============
24MongoDB Shell
35=============
@@ -10,6 +12,104 @@ MongoDB Shell
1012 :depth: 1
1113 :class: singlecol
1214
15+ .. include:: /includes/admonitions/fact-mdb-shell-beta.rst
16+
17+ The |mdb-shell| is a fully functional JavaScript environment for
18+ interacting with MongoDB deployments. You can use the |mdb-shell| to
19+ test queries and operations directly with your database.
20+
21+ The |mdb-shell| is available as a standalone package in the MongoDB
22+ download center.
23+
24+ Download and Install the |mdb-shell|
25+ ------------------------------------
26+
27+ .. tabs-platforms::
28+
29+ .. tab::
30+ :tabid: windows
31+
32+ Hello, I am Windows content.
33+
34+ .. tab::
35+ :tabid: macOS
36+
37+ Hello, I am macOS content.
38+
39+ .. tab::
40+ :tabid: linux
41+
42+ Hello, I am Linux (rpm / deb) content.
43+
44+ Multi-Line Operations in the |mdb-shell|
45+ ----------------------------------------
46+
47+ Run the ``.editor`` command within the |mdb-shell| to open the editor
48+ and manage comprehensive multiline functions:
49+
50+ .. example::
51+
52+ Run the following command within the |mdb-shell|:
53+
54+ .. code-block:: javascript
55+
56+ .editor
57+
58+ The |mdb-shell| enters editor mode:
59+
60+ .. code-block:: javascript
61+ :copyable: false
62+
63+ // Entering editor mode (^D to finish, ^C to cancel)
64+ const { Writable } = require('stream');
65+
66+ const myWritable = new Writable({
67+ write(chunk, encoding, callback) {
68+ // ...
69+ },
70+ writev(chunks, callback) {
71+ // ...
72+ }
73+ });
74+
75+ - Press ``Cmd/Ctrl`` + ``d`` to finish and run your function.
76+
77+ - Press ``Cmd/Ctrl`` + ``c`` to cancel and exit without running your
78+ function.
79+
80+ When you close the editor, the |mdb-shell| does not save any functions
81+ you had entered into the editor.
82+
83+ .. note::
84+
85+ Currently, ``editor()`` is the only way to paste multiline commands
86+ into the |mdb-shell|.
87+
88+
89+ The |mdb-shell| versus the Legacy ``mongo`` Shell
90+ -------------------------------------------------
91+
92+ The |mdb-shell| offers numerous advantages over the legacy
93+ :binary:`mongo <mongo>` shell, such as:
94+
95+ - Improved syntax highlighting.
96+
97+ - Improved command history.
98+
99+ - Improved logging.
100+
101+ During the beta stage, the |mdb-shell| supports a subset of the legacy
102+ :binary:`mongo <mongo>` shell commands. Extending the |mdb-shell| |api|
103+ coverage is an ongoing effort.
104+
105+ The commands that the |mdb-shell| supports use the same syntax as the
106+ corresponding commands in the legacy :binary:`mongo <mongo>` shell.
107+
108+ Learn More
109+ ----------
110+
111+ .. This will effectively be a ToC linking out to other parts of the docs
112+
13113.. class:: hidden
14114
15115 .. toctree::
0 commit comments