Skip to content

Instantly share code, notes, and snippets.

@chiarabeth
Created August 24, 2021 22:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chiarabeth/e7f8de61122f52e6f49d9a782500a615 to your computer and use it in GitHub Desktop.
Save chiarabeth/e7f8de61122f52e6f49d9a782500a615 to your computer and use it in GitHub Desktop.
Docker Mongo Step 7a
conn = new Mongo("mongo_source");
db = conn.getDB("admin");
db.auth("root", "rootpassword");
db.dropUser("lowAccessUser");
db.dropRole("lowAccessRole");
db.createRole({role: "lowAccessRole",
roles: [],
privileges: [
{resource: {db: "tutorial_db", collection: "Restaurants"}, actions: ["listCollections"] }
]
});
db.createUser({user: "lowAccessUser", pwd: "lowaccessuserpassword", roles: [{role: "lowAccessRole", db: "admin"}]});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment