-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmongo-init.js
58 lines (48 loc) · 1.34 KB
/
mongo-init.js
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
52
53
54
55
56
57
58
// Create Databases
const dbPims = db.getSiblingDB('pims');
const dbRemsAdmin = db.getSiblingDB('remsadmin');
const dbRemsAdmin2 = db.getSiblingDB('remsadmin2');
const dbRemsIntermediary = db.getSiblingDB('remsintermediary');
dbRemsAdmin.createUser({ user: "rems-user",
pwd: "pass",
roles: [
{ role: "readWrite", db: "remsadmin" }
]
})
dbRemsAdmin2.createUser({ user: "rems-user2",
pwd: "pass",
roles: [
{ role: "readWrite", db: "remsadmin2" }
]
})
dbRemsIntermediary.createUser({ user: "intermediary-user",
pwd: "pass",
roles: [
{ role: "readWrite", db: "remsintermediary" }
]
})
dbPims.createUser({ user: "pims-user",
pwd: "pims-pass",
roles: [
{ role: "readWrite", db: "pims" }
]
})
// Create Collections
dbPims.createCollection('pims-tmp');
dbRemsAdmin.createCollection('remsadmin-tmp');
dbRemsAdmin2.createCollection('remsadmin2-tmp');
dbRemsIntermediary.createCollection('remsintermediary-tmp');
// add the administrator user
const dbAdmin = db.getSiblingDB('admin');
dbAdmin.createUser({ user: "rems-admin-pims-root",
pwd: "rems-admin-pims-password",
roles: [
{ role: "userAdminAnyDatabase", db: "admin" }
]
})
dbAdmin.createUser({ user: "intermediary-admin-pims-root",
pwd: "intermediary-admin-pims-password",
roles: [
{ role: "userAdminAnyDatabase", db: "admin" }
]
})