-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit-mongo.js
More file actions
executable file
·54 lines (46 loc) · 1.13 KB
/
init-mongo.js
File metadata and controls
executable file
·54 lines (46 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
var rootUser = 'admin';
var rootPassword = 'changemenow';
db.createUser(
{
user: "admin",
pwd: "changemenow",
roles: [
{
role: "root",
db: "admin"
}
]
}
);
db.createUser(
{
user: "user0",
pwd: "changemenow",
roles: [
{
role: "readWrite",
db: "admin"
}
]
}
);
//db.createUser({user: 'admin', pwd: 'changemenow', roles:['root'], db: "admin"});
db.getSiblingDB("$external").runCommand(
{
createUser: "OU=Infrastructure,O=MongoDBClient,L=SB,ST=CA,C=US,CN=mongodb-test-client1",
roles: [
{ role: "userAdminAnyDatabase", db: "admin" }
],
writeConcern: { w: "majority" , wtimeout: 5000 }
}
)
db.getSiblingDB("$external").runCommand(
{
createUser: "OU=Infrastructure,O=MongoDBClient,L=SB,ST=CA,C=US,CN=mongodb-test-client2",
roles: [
{ role: "userAdminAnyDatabase", db: "admin" }
],
writeConcern: { w: "majority" , wtimeout: 5000 }
}
)
db.shutdownServer();