Skip to content

Commit 8c66148

Browse files
authored
Merge pull request #19 from clee/docs/README-mongo-init-fix
2 parents 081cb74 + 5d4ea38 commit 8c66148

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

readme-vars.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,10 @@ app_setup_block: |
6363
6464
**Make sure you pin your database image version and do not use `latest`, as mongodb does not support automatic upgrades between major versions.**
6565
66-
If you are using the [official mongodb container](https://hub.docker.com/_/mongo/), you can create your databases using an `init-mongo.js` file with the following contents:
66+
If you are using the [official mongodb container](https://hub.docker.com/_/mongo/), you can create your user using an `init-mongo.js` file with the following contents:
6767
6868
```js
69-
db.getSiblingDB("MONGO_DBNAME").createUser({user: "MONGO_USER", pwd: "MONGO_PASS", roles: [{role: "readWrite", db: "MONGO_DBNAME"}]});
70-
db.getSiblingDB("MONGO_DBNAME_stat").createUser({user: "MONGO_USER", pwd: "MONGO_PASS", roles: [{role: "readWrite", db: "MONGO_DBNAME_stat"}]});
69+
db.getSiblingDB("MONGO_DBNAME").createUser({user: "MONGO_USER", pwd: "MONGO_PASS", roles: [{role: "dbOwner", db: "MONGO_DBNAME"}, {role: "dbOwner", db: "MONGO_DBNAME_stat"}]});
7170
```
7271
7372
Being sure to replace the placeholders with the same values you supplied to the Unifi container, and mount it into your *mongodb* container.

0 commit comments

Comments
 (0)