Therefore, for some odd reason, my user does not get the right to write anything in the krimson database. The connection to the database is successful, but user access to write to the database does not work properly.
Complete mistake
Caused by: com.mongodb.MongoCommandException: Command failed with error 13: 'not authorized on krimson to execute command { findandmodify: "users", query: { _id: "_id" }, fields: {}, sort: {}, new: true, upsert: true, update: { $i
nc: { _id: 1 } } }' on server ds037395.mongolab.com:37395. The full response is { "ok" : 0.0, "errmsg" : "not authorized on krimson to execute command { findandmodify: \"users\", query: { _id: \"_id\" }, fields: {}, sort: {}, new:
true, upsert: true, update: { $inc: { _id: 1 } } }", "code" : 13 }
Connect code
public static void connects(String ip, int port, String database, String username, String password) {
try {
client = new MongoClient(ip, port);
krimson = client.getDB(database);
MongoCredential.createCredential(username, database, password.toCharArray());
} catch (Exception e){
e.printStackTrace();
System.out.println("Linking connections failed");
UtilServer.broadcast("&c&lThe Krimson Library did not establish a successfully connection.");
}
users = krimson.getCollection("users");
}
I tried to recreate the user and be reputed in credentials to find out if this problem was, and it is not. I am using MongoLab at the moment . Therefore, I am wondering if this could be one of the problems or not or if there is some specific way: I need to manually assign the role of user admin in MongoLab