1
- title : Find the `` mongo`` Shell
1
+ title : Locate the :binary:`~bin. mongo` shell.
2
2
ref : mongo-shell
3
3
level : 4
4
4
stepnum : 1
5
5
content : |
6
6
7
- The `` mongo`` shell is packaged with the MongoDB Server Community and
8
- Enterprise distributions, and is also available for users of Atlas as
9
- a client-only download.
7
+ The :binary:`~bin. mongo` shell is packaged with the MongoDB Server
8
+ Community and Enterprise distributions, and is also available for users
9
+ of Atlas as a client-only download.
10
10
11
11
MongoDB binaries are located in a directory that starts with
12
- " mongodb-". You should see a file named ``mongo``, which is the shell
13
- executable.
12
+ `` mongodb-``. Within a ``bin`` directory, you should see a file named
13
+ ``mongo``, which is the shell executable.
14
14
15
- If you do not have `` mongo`` shell installed, follow the install
16
- directions for your environment.
15
+ If you do not have :binary:`~bin. mongo` shell installed, follow the
16
+ install directions for your environment.
17
17
18
18
.. include:: /includes/download-shell-tabs.rst
19
19
@@ -28,18 +28,18 @@ content: |
28
28
.. include:: /includes/mongo-shell-platform-connect-np.rst
29
29
30
30
---
31
- title : Switch to the `admin` Database
31
+ title : Switch to the `` admin`` database.
32
32
ref : administrator
33
33
level : 4
34
34
stepnum : 3
35
35
content : |
36
36
37
37
.. code-block:: sh
38
38
39
- use admin;
39
+ use admin
40
40
41
41
---
42
- title : Create the user administrator
42
+ title : Create a :authrole:`root` user with the :method:`db.createUser()` method.
43
43
ref : create_user
44
44
level : 4
45
45
stepnum : 4
@@ -49,43 +49,23 @@ content: |
49
49
50
50
db.createUser(
51
51
{
52
- user: "myUserAdmin ",
53
- pwd: "abc123 ",
54
- roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
52
+ user: "superuser ",
53
+ pwd: "changeMeToAStrongPassword ",
54
+ roles: [ "root" ]
55
55
}
56
56
)
57
57
58
+ Users with the :authrole:`root` role have full privileges on all
59
+ resources. You can therefore use your new ``superuser`` user to query
60
+ your database, add indexes, create additional users, administer your deployment, etc.
58
61
---
59
- title : Create a user for reading and writing to your test database
60
- ref : create_user_rw
61
- level : 4
62
- stepnum : 5
63
- content : |
64
-
65
- It is a good idea to keep your admin user credentials separate from
66
- users that will read and write to the databases on a regular basis.
67
-
68
- In this step, create a user that you will use throughout the guides
69
- for reading and writing test data.
70
-
71
- .. code-block:: javascript
72
-
73
- db.createUser(
74
- {
75
- user: "userreadwrite",
76
- pwd: "abc123",
77
- roles: [ { role: "readWriteAnyDatabase", db: "admin" } ]
78
- }
79
- )
80
-
81
- ---
82
- title : Check whether your users have been added
62
+ title : Verify that you have successfully added your user.
83
63
ref : check_users
84
64
level : 4
85
- stepnum : 6
65
+ stepnum : 5
86
66
content : |
87
67
88
- Run ``show users`` to see if your users were created.
68
+ Run ``show users`` to see if your user was created:
89
69
90
70
.. code-block:: javascript
91
71
@@ -96,51 +76,47 @@ content: |
96
76
.. code-block:: sh
97
77
98
78
{
99
- "_id" : "admin.myUserAdmin",
100
- "user" : "myUserAdmin",
101
- "db" : "admin",
102
- "roles" : [
103
- {
104
- "role" : "userAdminAnyDatabase",
105
- "db" : "admin"
106
- }
107
- ],
108
- "mechanisms" : [
109
- "SCRAM-SHA-1",
110
- "SCRAM-SHA-256"
111
- ]
112
- }
113
- {
114
- "_id" : "admin.userreadwrite",
115
- "user" : "userreadwrite",
116
- "db" : "admin",
117
- "roles" : [
118
- {
119
- "role" : "readWriteAnyDatabase",
120
- "db" : "admin"
121
- }
122
- ],
123
- "mechanisms" : [
124
- "SCRAM-SHA-1",
125
- "SCRAM-SHA-256"
126
- ]
127
- }
79
+ "_id" : "admin.superuser",
80
+ "userId" : UUID("7c2aee5c-6af5-4e25-ae0f-4422c6a8a03c"),
81
+ "user" : "superuser",
82
+ "db" : "admin",
83
+ "roles" : [
84
+ {
85
+ "role" : "root",
86
+ "db" : "admin"
87
+ }
88
+ ],
89
+ "mechanisms" : [
90
+ "SCRAM-SHA-1",
91
+ "SCRAM-SHA-256"
92
+ ]
93
+ }
128
94
129
95
---
130
- title : Exit the ``mongo`` shell
131
- ref : exit_mongo
96
+ title : Shut down your MongoDB instance.
97
+ ref : shutdown_server
132
98
level : 4
133
- stepnum : 7
134
- content : |
135
-
136
- Use ``Ctrl-C`` to exit the ``mongo`` shell.
137
-
99
+ stepnum : 6
100
+ action :
101
+ - pre : |
102
+ From the ``mongo`` shell, shut down your :binary:`~bin.mongod`
103
+ instance.
104
+ language: sh
105
+ code: |
106
+ db.shutdownServer()
107
+ post: |
108
+ You should see a message that resembles
109
+ ``server should be down...``.
110
+ - pre : |
111
+ Type ``exit`` to exit the ``mongo`` shell.
112
+ language: sh
113
+ code: |
114
+ exit
138
115
---
139
- title : Re-start your MongoDB instance with access control enabled
116
+ title : Restart your MongoDB instance with access control.
140
117
ref : restart_with_auth
141
118
level : 4
142
- stepnum : 8
143
- ref : start-mdb
119
+ stepnum : 7
144
120
content : |
145
121
146
122
.. include:: /includes/start-server-auth.rst
0 commit comments