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"}] }
)