Skip to content

Instantly share code, notes, and snippets.

@atu4403
Created December 23, 2021 05:22
Show Gist options
  • Save atu4403/3e7ad56f374c286eaeb72aa8e0f88aad to your computer and use it in GitHub Desktop.
Save atu4403/3e7ad56f374c286eaeb72aa8e0f88aad to your computer and use it in GitHub Desktop.
mongodbでuserを追加する方法
(function () {
db.createUser({
user: 'testuser2',
pwd: 'testpass2',
roles: [{role: 'readWrite', db: 'test_db2'}],
});
})();
mongosh --host <mongo_host> --username <mongo_root_user> --port <mongo_port> -f mongouser.js admin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment