File tree Expand file tree Collapse file tree 1 file changed +2
-8
lines changed Expand file tree Collapse file tree 1 file changed +2
-8
lines changed Original file line number Diff line number Diff line change @@ -66,15 +66,11 @@ int EXAMPLES_CDECL main() {
66
66
// uriString = 'mongodb://mongos0.example.com:27017,mongos1.example.com:27017/'
67
67
mongocxx::client client{mongocxx::uri{" mongodb://localhost/?replicaSet=repl0" }};
68
68
69
+ // Prepare to set majority write explicitly. Note: on Atlas deployments this won't always be
70
+ // needed. The suggested Atlas connection string includes majority write concern by default.
69
71
write_concern wc_majority{};
70
72
wc_majority.acknowledge_level (write_concern::level::k_majority);
71
73
72
- read_concern rc_local{};
73
- rc_local.acknowledge_level (read_concern::level::k_local);
74
-
75
- read_preference rp_primary{};
76
- rp_primary.mode (read_preference::read_mode::k_primary);
77
-
78
74
// Prereq: Create collections.
79
75
80
76
auto foo = client[" mydb1" ][" foo" ];
@@ -107,8 +103,6 @@ int EXAMPLES_CDECL main() {
107
103
try {
108
104
options::transaction opts;
109
105
opts.write_concern (wc_majority);
110
- opts.read_concern (rc_local);
111
- opts.read_preference (rp_primary);
112
106
113
107
session.with_transaction (callback, opts);
114
108
} catch (const mongocxx::exception& e) {
You can’t perform that action at this time.
0 commit comments