Skip to content

Commit 176a37d

Browse files
committed
Tech feedback
1 parent d33baac commit 176a37d

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

source/crud/configure.txt

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,12 @@ if they fail due to a network or server error.
199199

200200
You can explicitly disable retryable reads or retryable writes by setting the ``RetryReads``
201201
or ``RetryWrites`` options on a ``MongoClientSettings`` object and passing this object to the
202-
``MongoClient`` constructor. The following example disables retryable reads and writes for
203-
a client:
202+
``MongoClient`` constructor. You can also set the ``retryReads`` or ``retryWrites`` options
203+
in a connection string.
204+
205+
The following example disables retryable reads and writes for
206+
a client. Select the :guilabel:`MongoClientSettings` or :guilabel:`Connection String`
207+
tab to see the corresponding code.
204208

205209
.. literalinclude:: /includes/fundamentals/code-examples/ReplicaSetConfigs.cs
206210
:start-after: start-retry-reads-writes
@@ -209,6 +213,28 @@ a client:
209213
:language: csharp
210214
:dedent:
211215

216+
.. tabs::
217+
218+
.. tab:: MongoClientSettings
219+
:tabid: mongoclientsettings
220+
221+
.. literalinclude:: /includes/fundamentals/code-examples/ReplicaSetConfigs.cs
222+
:start-after: start-retry-reads-writes
223+
:end-before: end-retry-reads-writes
224+
:emphasize-lines: 2-3
225+
:language: csharp
226+
:dedent:
227+
228+
.. tab:: Connection String
229+
:tabid: connectionstring
230+
231+
.. literalinclude:: /includes/fundamentals/code-examples/ReplicaSetConfigs.cs
232+
:start-after: start-retry-reads-writes
233+
:end-before: end-retry-reads-writes
234+
:emphasize-lines: 1
235+
:language: csharp
236+
:dedent:
237+
212238
To learn more about supported retryable read and retryable write operations, see
213239
:manual:`Retryable Reads </core/retryable-reads/>`
214240
and :manual:`Retryable Writes </core/retryable-writes/>` in the {+mdb-server+} manual.

source/includes/fundamentals/code-examples/ReplicaSetConfigs.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,13 @@ public static void Main(string[] args)
6262
var mongoClient = new MongoClient(mongoClientSettings);
6363
// end-retry-reads-writes
6464
}
65+
66+
{
67+
// start-retry-reads-writes-connection-string
68+
var connectionString = "mongodb://localhost:27017/?retryReads=false&retryWrites=false";
69+
var mongoClientSettings = MongoClientSettings.FromConnectionString(connectionString);
70+
var mongoClient = new MongoClient(mongoClientSettings);
71+
// end-retry-reads-writes-connection-string
72+
}
6573
}
6674
}

0 commit comments

Comments
 (0)