Skip to content

Commit 283c272

Browse files
DOCSP-49301 Fix X.509 MongoCredential code example (#590) (#600)
(cherry picked from commit be38a20) Co-authored-by: Stephanie <[email protected]>
1 parent 77847ad commit 283c272

File tree

1 file changed

+7
-4
lines changed
  • source/fundamentals/authentication

1 file changed

+7
-4
lines changed

Diff for: source/fundamentals/authentication/x509.txt

+7-4
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,12 @@ Code Placeholders
3838

3939
The code examples on this page use the following placeholders:
4040

41-
- ``+srv``: Include this option in your connection string prefix only if you are connecting
42-
to a MongoDB Atlas cluster. To learn more about the ``+srv`` option, see
43-
:manual:`Connection String Formats </reference/connection-string/#connection-string-formats>`
44-
in the {+mdb-server+} manual.
41+
- ``+srv``: Include this option in your connection string prefix only if you are
42+
connecting to a MongoDB Atlas cluster. If you're using a
43+
``MongoClientSettings`` object, you can specify the ``srv`` format by setting
44+
the ``Scheme`` property to ``ConnectionStringScheme.MongoDBPlusSrv``. To learn
45+
more about the ``+srv`` option, see :manual:`Connection String Formats </reference/connection-string/#connection-string-formats>` in the
46+
{+mdb-server+} manual.
4547
- ``<hostname>``: The network address of your MongoDB deployment.
4648
- ``<port>``: The port number of the MongoDB deployment. If you omit this parameter,
4749
the driver uses the default port number (``27017``). You don't need a port number
@@ -119,6 +121,7 @@ see the corresponding syntax:
119121
},
120122
UseTls = true,
121123
Server = new MongoServerAddress("<hostname>"[, "<port>"]),
124+
Scheme = ConnectionStringScheme.MongoDBPlusSrv, // Needed when connecting to MongoDB Atlas
122125
};
123126

124127
Troubleshooting

0 commit comments

Comments
 (0)