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