use mydbdb.createUser( { "user" : "sa", "pwd": "sa", "customData" : { employeeId: 12345 }, "roles" : [ { role: "clusterAdmin", db: "admin" }, { role: "readAnyDatabase", db: "admin" }, "readWrite" ] }, { w: "majority" , wtimeout: 5000 } )mongo -u sa -p sa --authenticationDatabase mydb