-
Type:
Bug
-
Resolution: Done
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Hello, folks!
I'm trying to connect to remote database with login/password and enabled MONGODB-CR auth mode.
So I could not achieve it:
std::string connection_string = "mongodb://user:cooPh5ohcei0Iewe@xxxx:27017/"; mongocxx::instance inst{}; mongocxx::client conn{mongocxx::uri{connection_string}}; std::cout << "username: " << conn.uri().username() << std::endl; std::cout << "password: " << conn.uri().password() << std::endl; auto db = conn["fastnetmon"]; std::string collection_name = "configuration"; if (!db.has_collection(collection_name)) { std::cout << "Connection failed" << std::endl; } {/code} From Mongo's side I haven't saw any auth tries:
2016-02-12T16:10:32.132+0100 I NETWORK [initandlisten] connection accepted from xxxx:46591 #12 (1 connection now open)
2016-02-12T16:10:32.175+0100 I NETWORK [conn12] end connection xxx:46591 (0 connections now open)
But I definitely have this database and could connect to it with standard mongo client:
mongo xxxxx/fastnetmon --username user --password cooPh5ohcei0Iewe --authenticationMechanism MONGODB-CR --authenticationDatabase admin{/code}
Could you help me? That's really important because I could not ask folks on other side to disable authentication.