Merge pull request #28 from linuxserver/readme-update

Fix init permissions for older mongo versions
This commit is contained in:
driz 2023-11-07 14:23:09 -05:00 committed by GitHub
commit 0346eb34af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -68,7 +68,8 @@ app_setup_block: |
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: 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:
```js ```js
db.getSiblingDB("MONGO_DBNAME").createUser({user: "MONGO_USER", pwd: "MONGO_PASS", roles: [{role: "dbOwner", db: "MONGO_DBNAME"}, {role: "dbOwner", db: "MONGO_DBNAME_stat"}]}); db.getSiblingDB("MONGO_DBNAME").createUser({user: "MONGO_USER", pwd: "MONGO_PASS", roles: [{role: "dbOwner", db: "MONGO_DBNAME"}]});
db.getSiblingDB("MONGO_DBNAME_stat").createUser({user: "MONGO_USER", pwd: "MONGO_PASS", roles: [{role: "dbOwner", db: "MONGO_DBNAME_stat"}]});
``` ```
Being sure to replace the placeholders with the same values you supplied to the Unifi container, and mount it into your *mongodb* container. Being sure to replace the placeholders with the same values you supplied to the Unifi container, and mount it into your *mongodb* container.