Reputation: 332
I'm trying to connect to a local MongoDB with authentication but failing.
DBClientConnection c;
string errMsg;
c.connect("localhost");
bool success = c.auth("ss1", "admin", "password", errMsg);
auth()
returns always false, and the errMsg is { ok: 0.0, errmsg: "auth failed", code: 18 }
Upvotes: 1
Views: 388
Reputation: 332
Neil Lunn and acm were right. Using the newer version did solve the authentication issue. Thank you
Upvotes: 1