Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-167

Clarification on mongo_connect example in tutorial

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 0.7
    • 0.6
    • None
    • None

    Description

      The API docs @ http://api.mongodb.org/c/current/tutorial.html#connecting include an example which suggests that you can get a mongo_connect() return value which is != MONGO_OK but still be able to check for MONGO_CONN_SUCCESS:

       int status = mongo_connect( conn, "127.0.0.1", 27017 );
       
       if( status != MONGO_OK ) {
            switch ( conn->err ) {
              case MONGO_CONN_SUCCESS:    printf( "connection succeeded\n" ); break;
      ...

      Although conn->err is 0 (MONGO_CONN_SUCCESS) when connected, it doesn't seem possible to get both an error and be successfully connected?

      Attachments

        Activity

          People

            Unassigned Unassigned
            stephen.steneker@mongodb.com Stennie Steneker (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: