@@ -12,24 +12,23 @@ Embedded MongoDB Shell
12
12
:depth: 1
13
13
:class: singlecol
14
14
15
- Starting in version 1.22, |compass| contains an embedded
16
- `MongoDB Shell <https://docs.mongodb.com/mongodb-shell/>`__. The
17
- MongoDB Shell is a fully functional JavaScript environment for
18
- interacting with MongoDB deployments. You can use the MongoDB Shell to
19
- test queries and operations directly with your database.
15
+ Starting in version 1.22, |compass| contains an embedded shell,
16
+ :binary:`mongosh`. :binary:`mongosh` is a JavaScript environment for
17
+ interacting with MongoDB deployments. You can use :binary:`mongosh`
18
+ to test queries and operations in your database.
20
19
21
20
Open the Embedded MongoDB Shell
22
21
-------------------------------
23
22
24
- To open the embedded MongoDB Shell , click :guilabel:`MongoSH Beta `
25
- along the bottom of |compass|.
23
+ To open the embedded :binary:`mongosh` , click :guilabel:`_MONGOSH `
24
+ at the bottom of the |compass| window .
26
25
27
26
Use the Embedded MongoDB Shell
28
27
------------------------------
29
28
30
- When you initially open the MongoDB Shell, it connects to the
31
- ``test`` database. To switch to a different database, run
32
- the following command in the MongoDB Shell :
29
+ By default, :binary:`mongosh`, connects to the ``test`` database.
30
+ To use a different database, run the following command in
31
+ :binary:`mongosh` :
33
32
34
33
.. code-block:: sh
35
34
@@ -38,27 +37,27 @@ the following command in the MongoDB Shell:
38
37
To run an operation in the embedded MongoDB Shell, type the operation
39
38
into the shell and press :guilabel:`Enter`.
40
39
40
+ The following example runs a :method:`db.collection.find()` operation:
41
+
41
42
.. example::
42
43
43
44
.. code-block:: sh
44
45
45
46
db.employees.find( { "last_name": "Smith" } )
46
47
47
- .. seealso::
48
-
49
- :manual:`db.collection.find()
50
- </reference/method/db.collection.find>`
51
-
52
48
Multi-Line Operations in the Embedded MongoDB Shell
53
49
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
54
50
55
51
To write an operation that spans multiple lines in the embedded
56
- MongoDB Shell, press :guilabel:`Shift + Enter` to begin the next
57
- line of code.
52
+ :binary:`mongosh`, begin with the first line, then press
53
+ :guilabel:`Shift + Enter` to move to the next line of code.
58
54
59
55
When you are finished writing your operation, press :guilabel:`Enter`
60
56
to run it.
61
57
58
+ The following multi-line example runs the :pipeline:`$match` stage in
59
+ an :ref:`aggregation pipeline <aggregation-pipeline>`:
60
+
62
61
.. example::
63
62
64
63
.. code-block:: javascript
@@ -67,27 +66,20 @@ to run it.
67
66
{ $match: { "last_name": "Smith" } } // press Shift + Enter
68
67
] ) // Press Enter
69
68
70
- .. seealso::
71
-
72
- :pipeline:`$match`
73
-
74
69
Learn More
75
70
~~~~~~~~~~
76
71
77
72
The following links direct to the
78
- `MongoDB Shell Documentation
79
- <https://docs.mongodb.com/mongodb-shell/>`__, which contains more
80
- complete reference for the MongoDB Shell, including syntax and
73
+ :ref:`mongosh documentation <mdb-shell-overview>`, which contains
74
+ more a complete reference for :binary:`mongosh`, including syntax and
81
75
behaviors.
82
76
83
- - Learn how to
84
- `Perform CRUD Operations in the MongoDB Shell
85
- <https://docs.mongodb.com/mongodb-shell/crud>`__.
77
+ - Learn how to :ref:`perform CRUD operations <mdb-shell-crud>` in
78
+ :binary:`mongosh`.
79
+
80
+ - Learn how to :ref:`run aggregation pipelines <mdb-shell-aggregation>`
81
+ in :binary:`mongosh`.
86
82
87
- - Learn how to
88
- `Run Aggregation Pipelines in the MongoDB Shell
89
- <https://docs.mongodb.com/mongodb-shell/run-agg-pipelines>`__.
83
+ - See a complete list of :binary:`mongosh` :ref:`methods
84
+ <mdb-shell-methods>`.
90
85
91
- - See a complete list of
92
- `Available MongoDB Shell Methods
93
- <https://docs.mongodb.com/mongodb-shell/reference/methods>`__.
0 commit comments