Answer the question
In order to leave comments, you need to log in
How to create a user for mongoDB?
How to create a user for mongoDB using Mongoose or Mongo native driver?
Answer the question
In order to leave comments, you need to log in
createUser
for Java something like this
MongoClient mongo = new MongoClient("localhost", 27017);
MongoDatabase db = mongo.getDatabase("testDb");
BasicDBObject command = new BasicDBObject();
command.put("createUser", "testUser");
command.put("pwd", "testPassword");
command.put("roles", new String[]{"readWrite"});
db.runCommand(command);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question