To keep security for the mongodb server, we can create an authorized machanism.
db.createUser( { user: "user1", pwd: "passwd", roles:[{"role": "userAdminAnyDatabase", "db": "admin"}] } ) db.createUser( { user: "user2", pwd: "passwd", roles:[{"role": "readWrite", "db": "database"}] } )
时间: 2024-11-03 03:44:11