use unionserver db.createUser({ user: "rshy",pwd: "root1234@......",customData:{name:"root"},roles:[{ role: "userAdminAnyDatabase",db: "admin" }]}) db.grantRolesToUser("rshy", [ { role:"dbOwner", db:"fanwen"} ]) ; db.grantRolesToUser("admin", [ { role:"dbOwner", db:"fanwen"} ]) ; show users use zhuna use admin db.grantRolesToUser("rshy", [ { role:"dbOwner", db:"zhuna"} ]) ; db.grantRolesToUser("admin", [ { role:"dbOwner", db:"zhuna"} ]) ; db.zhuna.insert({"name":"菜"}) use zhuna_test use admin db.grantRolesToUser("rshy", [ { role:"dbOwner", db:"zhuna_test"} ]) ; db.grantRolesToUser("admin", [ { role:"dbOwner", db:"zhuna_test"} ]) ; db.zhuna_test.insert({"name":"菜"}) use liuxue use liuxue use admin db.grantRolesToUser("rshy", [ { role:"dbOwner", db:"liuxue"} ]) ; db.grantRolesToUser("admin", [ { role:"dbOwner", db:"liuxue"} ]) ; db.liuxue.insert({"name":"菜"}) use liuxue_test use admin db.grantRolesToUser("rshy", [ { role:"dbOwner", db:"liuxue_test"} ]) ; db.grantRolesToUser("admin", [ { role:"dbOwner", db:"liuxue_test"} ]) ; db.liuxue_test.insert({"name":"菜"})