1
- .. _mongo:
2
-
3
- .. meta::
4
- :description: The mongo shell man page
5
- :keywords: man page, mongo, javascript, shell
6
-
7
- .. default-domain:: mongodb
8
-
9
1
================
10
2
mongo
11
3
================
4
+ .. only:: html
5
+
6
+ .. meta::
7
+ :description: The mongo command man page.
8
+ :keywords: mongo, mongodb, man page, mongo process, mongo shell
9
+
10
+ .. default-domain:: mongodb
11
+
12
+ .. _mongo:
12
13
13
14
Synopsis
14
15
--------
@@ -19,10 +20,10 @@ Description
19
20
-----------
20
21
21
22
:program:`mongo` is an interactive JavaScript shell interface to
22
- MongoDB. :program:`mongo` provides a powerful interface
23
+ MongoDB. The :program:`mongo` command provides a powerful interface
23
24
for systems administrators as well as a way to test queries and
24
25
operations directly with the database. To increase the flexibility of
25
- :program:`mongo`, the shell provides a fully functional JavaScript
26
+ the :program:`mongo` command , the shell provides a fully functional JavaScript
26
27
environment. This document addresses the basic invocation of the
27
28
:program:`mongo` shell and an overview of its usage.
28
29
@@ -37,60 +38,63 @@ Options
37
38
38
39
.. cmdoption:: --shell
39
40
40
- If you invoke the :program:`mongo` and specify a :term:`JavaScript`
41
- file as an argument, or ":option:`mongo --eval`" the
42
- :option:`--shell` option provides the user with a shell prompt after the
43
- file finishes executing.
41
+ Enables the shell interface after a :term:`JavaScript` file is evaluated.
42
+ If you invoke the :program:`mongo` command and specify a JavaScript
43
+ file as an argument, or use :option:`mongo --eval` to specify
44
+ JavaScript on the command line, the :option:`mongo --shell` option
45
+ provides the user with a shell prompt after the file finishes
46
+ executing.
44
47
45
48
.. cmdoption:: --nodb
46
49
47
- Use this option to prevent the shell from connecting to any
48
- database instance.
50
+ Prevents the shell from connecting to any database instances.
49
51
50
52
.. cmdoption:: --norc
51
53
52
- By default :program:`mongo` runs the ``~/.mongorc.js`` file when it
53
- starts. Use this option to prevent the shell from sourcing this
54
- file on start up.
55
-
54
+ Prevents the shell from sourcing and evaluating
55
+ :file:`~/.mongorc.js` on startup.
56
+
56
57
.. cmdoption:: --quiet
57
58
58
59
Silences output from the shell during the connection process.
59
60
60
61
.. cmdoption:: --port <PORT>
61
62
62
- Specify the port where the :program:`mongod` or :program:`mongos`
63
+ Specifies the port where the :program:`mongod` or :program:`mongos`
63
64
instance is listening. Unless specified :program:`mongo` connects
64
65
to :program:`mongod` instances on port 27017, which is the default
65
66
:program:`mongod` port.
66
67
67
68
.. cmdoption:: --host <HOSTNAME>
68
69
69
- Specific the host where the :program:`mongod` or :program:`mongos` is running to
70
+ specifies the host where the :program:`mongod` or :program:`mongos` is running to
70
71
connect to as ``<HOSTNAME>``. By default :program:`mongo` will attempt
71
- to connect to MongoDB process running on the localhost.
72
+ to connect to a MongoDB process running on the localhost.
72
73
73
74
.. cmdoption:: --eval <JAVASCRIPT>
74
75
75
- Evaluates a JavaScript specified as an argument to this
76
+ Evaluates a JavaScript expression specified as an argument to this
76
77
option. :program:`mongo` does not load its own environment when evaluating
77
78
code: as a result many options of the shell environment are not
78
79
available.
79
80
80
81
.. cmdoption:: --username <USERNAME>, -u <USERNAME>
81
82
82
- Specify a username to authenticate to the MongoDB instance, if your
83
- database requires authentication. Use in conjunction with the
83
+ Specifies a username to authenticate to the MongoDB instance.
84
+ Use in conjunction with the
84
85
:option:`mongo --password` option to supply a password.
86
+ If you specify a username and password but the default database
87
+ or the specified database do not require authentication,
88
+ :program:`mongo` will exit with an exception.
85
89
86
90
.. cmdoption:: --password <password>, -p <password>
87
91
88
- Specify a password to authenticate to the MongoDB instance, if your
89
- database requires authentication. Use in conjunction with the
92
+ Specifies a password to authenticate to the MongoDB instance.
93
+ Use in conjunction with the
90
94
:option:`mongo --username` option to supply a username. If you
91
95
specify a :option:`--username <mongo --username>` without the
92
96
:option:`mongo --password` option, :program:`mongo` will prompt for a
93
- password interactively.
97
+ password interactively if authentication is required .
94
98
95
99
.. cmdoption:: --help, -h
96
100
@@ -114,7 +118,7 @@ Options
114
118
115
119
.. cmdoption:: <db address>
116
120
117
- Specify the "database address" of the database to connect to. For
121
+ Specifies the "database address" of the database to connect to. For
118
122
example: ::
119
123
120
124
mongo admin
@@ -133,8 +137,9 @@ Options
133
137
134
138
.. cmdoption:: <file.js>
135
139
136
- Optionally, specify a JavaScript file as the final argument to the
137
- shell. The shell will run the file and then exit. Use the
140
+ Specifies a JavaScript file to run and then exit.
141
+ Must be the last option specified.
142
+ Use the
138
143
:option:`mongo --shell` option to return to a shell after the file
139
144
finishes running.
140
145
@@ -224,21 +229,21 @@ Environment
224
229
225
230
.. envvar:: EDITOR
226
231
227
- Specify the path to an editor to use with the `edit` shell command.
232
+ Specifies the path to an editor to use with the `edit` shell command.
228
233
A JavaScript variable `EDITOR` will override the value of
229
234
:envvar:`EDITOR`.
230
235
231
236
.. envvar:: HOME
232
237
233
- Specify the path to the home directory where `.mongorc.js` will be
234
- read from and `.dbshell` will be written to.
238
+ specifies the path to the home directory where :file: `.mongorc.js` will be
239
+ read from and :file: `.dbshell` will be written to.
235
240
236
241
.. envvar:: HOMEDRIVE
237
242
238
- Specify the Windows path to the home directory where `.mongorc.js` will be
239
- read from and `.dbshell` will be written to.
243
+ specifies the Windows path to the home directory where :file: `.mongorc.js` will be
244
+ read from and :file: `.dbshell` will be written to.
240
245
241
246
.. envvar:: HOMEPATH
242
247
243
- Specify the Windows path to the home directory where `.mongorc.js` will be
244
- read from and `.dbshell` will be written to.
248
+ specifies the Windows path to the home directory where :file: `.mongorc.js` will be
249
+ read from and :file: `.dbshell` will be written to.
0 commit comments