summaryrefslogtreecommitdiff
path: root/data/init-mongodb.js
blob: 6057d848054d4337d70243d41a6d61aa86e25b0b (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
29
30

// To help improve our products, anonymous usage data is collected and sent to MongoDB periodically (https://www.mongodb.com/legal/privacy-policy).
// You can opt-out by running the disableTelemetry() command.
disableTelemetry()

// 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"})

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

// Restart server now
db.shutdownServer()