-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmongo-init.js
22 lines (17 loc) · 949 Bytes
/
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
function createDbAndUser(dbName, user, pwd) {
var createdDb = db.getSiblingDB(dbName);
createdDb.createCollection('initCollection');
createdDb.createUser({
user: user,
pwd: pwd,
roles: [{ role: 'readWrite', db: dbName }]
});
}
console.log("Initialising Mongodb databases and users...")
createDbAndUser('BLUEPRINTS_DB', 'BLUEPRINTS_USER', 'BLUEPRINTS_PASSWORD');
createDbAndUser('RESTORATIONS_DB', 'RESTORATIONS_USER', 'RESTORATIONS_PASSWORD');
createDbAndUser('METADATA_DB', 'METADATA_USER', 'METADATA_PASSWORD');
createDbAndUser('WORKSHEETS_DB', 'WORKSHEETS_USER', 'WORKSHEETS_PASSWORD');
createDbAndUser('ANONYMISATION_EXECUTION_DB', 'ANONYMISATION_EXECUTION_USER', 'ANONYMISATION_EXECUTION_PASSWORD');
createDbAndUser('ANONYMISATION_ORCHESTRATION_DB', 'ANONYMISATION_ORCHESTRATION_USER', 'ANONYMISATION_ORCHESTRATION_PASSWORD');
console.log("Successfully initialised all Mongodb databases and users.")