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

Clarification on mongo_connect example in tutorial

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 0.7
    • Affects Version/s: 0.6
    • Component/s: None
    • None

      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?

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

              Created:
              Updated:
              Resolved: