Skip to content

Commit 6dc9fc3

Browse files
committed
Fix session start with readPref
1 parent bc3fd14 commit 6dc9fc3

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

source/includes/driver-examples/driver-example-transactions-retry-3.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
}
6868
6969
// Start a session.
70-
session = db.getMongo().startSession( { mode: "primary" } );
70+
session = db.getMongo().startSession( { readPreference: { mode: "primary" } } );
7171
7272
try{
7373
runTransactionWithRetry(updateEmployeeInfo, session);

source/reference/method/Session.abortTransaction.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ or in committing the transaction, the session aborts the transaction.
166166
} // End of updateEmployeeInfo function
167167

168168
// Start a session.
169-
session = db.getMongo().startSession( { mode: "primary" } );
169+
session = db.getMongo().startSession( { readPreference: { mode: "primary" } } );
170170

171171
try{
172172
runTransactionWithRetry(updateEmployeeInfo, session);

source/reference/method/Session.commitTransaction.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ as a single transaction.
148148
}
149149

150150
// Start a session.
151-
session = db.getMongo().startSession( { mode: "primary" } );
151+
session = db.getMongo().startSession( { readPreference: { mode: "primary" } } );
152152

153153
try{
154154
runTransactionWithRetry(updateEmployeeInfo, session);

source/reference/method/Session.startTransaction.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ as a single transaction.
220220
}
221221

222222
// Start a session.
223-
session = db.getMongo().startSession( { mode: "primary" } );
223+
session = db.getMongo().startSession( { readPreference: { mode: "primary" } } );
224224

225225
try{
226226
runTransactionWithRetry(updateEmployeeInfo, session);

0 commit comments

Comments
 (0)