grant Role To User mongodb code example Example: mongo grant role tu user db.grantRolesToUser("admin", [{role: "readWrite", db: "local"}]);