MongoDB 8 · Backup and administration
Create a user
Create a user with read and write access to one database. Use a real password.
db.createUser({ user: "appUser", pwd: "change-me", roles: [{ role: "readWrite", db: "mydb" }] })
Official MongoDB 8 documentation
More backup and administration commands
- Back up a database
- Restore a dump
- Export a collection to JSON
- Import JSON
- Check database size
- Drop a collection
All backup and administration commands · MongoDB 8 cheatsheet