summaryrefslogtreecommitdiff
path: root/data/init-mongodb.js
blob: 054dfd1591f0e1c2633c72fc831db38cd19835c1 (plain)
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
// Create the DB by inserting some data
db.REPLACE_COLLECTION.insertOne({init_key: "init_data"})

// Create user
db.createUser(
    {
        user: "REPLACE_USERNAME",
        pwd: "REPLACE_PASSWORD",
        roles: [
            {
                role: "readWrite",
                db: "production"
            }
        ]
    }
)

// Delete the init data
db.REPLACE_COLLECTION.deleteOne({init_key: "init_data"})

// Add healthcheck
db.healthcheck.insertOne({healthcheck: "ok"})

// Disable the ad about monitoring
db.disableFreeMonitoring()

// Restart server now
db.shutdownServer()