File tree 1 file changed +7
-4
lines changed
source/fundamentals/authentication
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -38,10 +38,12 @@ Code Placeholders
38
38
39
39
The code examples on this page use the following placeholders:
40
40
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.
45
47
- ``<hostname>``: The network address of your MongoDB deployment.
46
48
- ``<port>``: The port number of the MongoDB deployment. If you omit this parameter,
47
49
the driver uses the default port number (``27017``). You don't need a port number
@@ -119,6 +121,7 @@ see the corresponding syntax:
119
121
},
120
122
UseTls = true,
121
123
Server = new MongoServerAddress("<hostname>"[, "<port>"]),
124
+ Scheme = ConnectionStringScheme.MongoDBPlusSrv, // Needed when connecting to MongoDB Atlas
122
125
};
123
126
124
127
Troubleshooting
You can’t perform that action at this time.
0 commit comments