File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -49,10 +49,10 @@ auto client = mongocxx::client(uri);
49
49
50
50
// start-auth-err
51
51
try {
52
- auto uri = mongocxx::uri (" mongodb://<> "
53
- " authMechanism=<> " );
52
+ auto uri = mongocxx::uri (" mongodb://<db_username>:<db_password>@<hostname>:<port>/? "
53
+ " authSource=admin& authMechanism=SCRAM-SHA-256 " );
54
54
auto client = mongocxx::client (uri);
55
- } catch (const mongocxx::exception& e ) {
56
- std::cerr << " Error: " << e .code () << std::endl;
55
+ } catch (const mongocxx::exception& ex ) {
56
+ std::cerr << " Error: " << ex .code () << std::endl;
57
57
}
58
58
// end-auth-err
Original file line number Diff line number Diff line change @@ -285,6 +285,9 @@ the error code by using the ``code()`` method.
285
285
:start-after: // start-auth-err
286
286
:end-before: // end-auth-err
287
287
288
+ For more information, see the 'Operation Exceptions page
289
+ <{+api+}/topic-mongocxx-examples-operation-exceptions.html>' in the API Documentation.
290
+
288
291
API Documentation
289
292
-----------------
290
293
You can’t perform that action at this time.
0 commit comments