只读账号

db.createUser({
    "user":  "xxx",
    "pwd": "password",
    "roles": [
        {
            "role": "read",
            "db": "database"
        }
    ]
})

读写账号

role: readWrite