Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-842

C++ 11 master driver - can't execute authentification

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None

    Description

      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)

      {/code}

      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.

      Attachments

        Activity

          People

            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            pavel.odintsov Pavel Odintsov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: