Skip to content

Commit

Permalink
add link
Browse files Browse the repository at this point in the history
  • Loading branch information
rachel-mack committed Jan 8, 2025
1 parent 35f3a33 commit 5a4866c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 4 additions & 4 deletions source/includes/authentication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ auto client = mongocxx::client(uri);

// start-auth-err
try {
auto uri = mongocxx::uri("mongodb://<>"
"authMechanism=<>");
auto uri = mongocxx::uri("mongodb://<db_username>:<db_password>@<hostname>:<port>/?"
"authSource=admin&authMechanism=SCRAM-SHA-256");
auto client = mongocxx::client(uri);
} catch (const mongocxx::exception& e) {
std::cerr << "Error: " << e.code() << std::endl;
} catch (const mongocxx::exception& ex) {
std::cerr << "Error: " << ex.code() << std::endl;
}
// end-auth-err
3 changes: 3 additions & 0 deletions source/security/authentication.txt
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@ the error code by using the ``code()`` method.
:start-after: // start-auth-err
:end-before: // end-auth-err

For more information, see the 'Operation Exceptions page
<{+api+}/topic-mongocxx-examples-operation-exceptions.html>' in the API Documentation.

API Documentation
-----------------

Expand Down

0 comments on commit 5a4866c

Please sign in to comment.