Skip to content

Commit 6cdceae

Browse files
committed
wrap config writeConcernMax in writeConcern
1 parent c8e946d commit 6cdceae

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

test/functional/bulk.test.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ describe('Bulk', function() {
760760
batch.insert({ b: 1 });
761761

762762
// Execute the operations
763-
batch.execute(self.configuration.writeConcernMax(), function(err, result) {
763+
batch.execute(self.configuration.writeConcernMax().writeConcern, function(err, result) {
764764
expect(err).to.exist;
765765
expect(result).to.not.exist;
766766

@@ -812,7 +812,7 @@ describe('Bulk', function() {
812812
batch.insert({ a: 1 });
813813

814814
// Execute the operations
815-
batch.execute(configuration.writeConcernMax(), (err, result) => {
815+
batch.execute(configuration.writeConcernMax().writeConcern, (err, result) => {
816816
expect(err).to.exist;
817817
expect(result).to.not.exist;
818818

@@ -872,7 +872,7 @@ describe('Bulk', function() {
872872
batch.insert({ b: 1 });
873873

874874
// Execute the operations
875-
batch.execute(self.configuration.writeConcernMax(), function(err, result) {
875+
batch.execute(self.configuration.writeConcernMax().writeConcern, function(err, result) {
876876
expect(err).to.exist;
877877
expect(result).to.not.exist;
878878

@@ -928,7 +928,7 @@ describe('Bulk', function() {
928928
.updateOne({ $set: { b: 2 } });
929929

930930
// Execute the operations
931-
batch.execute(self.configuration.writeConcernMax(), function(err, result) {
931+
batch.execute(self.configuration.writeConcernMax().writeConcern, function(err, result) {
932932
// Check state of result
933933
test.equal(1, result.nUpserted);
934934
test.equal(0, result.nInserted);

test/tools/runner/config.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ class NativeConfiguration {
108108
Object.assign(dbOptions, { replicaSet: this.options.replicaSet, auto_reconnect: false });
109109
}
110110

111+
// Flatten any options nested under `writeConcern` before we make the connection string
112+
if (dbOptions.writeConcern) {
113+
Object.assign(dbOptions, dbOptions.writeConcern);
114+
delete dbOptions.writeConcern;
115+
}
116+
111117
const urlOptions = {
112118
protocol: 'mongodb',
113119
slashes: true,
@@ -224,10 +230,10 @@ class NativeConfiguration {
224230

225231
writeConcernMax() {
226232
if (this.topologyType !== TopologyType.Single) {
227-
return { w: 'majority', wtimeout: 30000 };
233+
return { writeConcern: { w: 'majority', wtimeout: 30000 } };
228234
}
229235

230-
return { w: 1 };
236+
return { writeConcern: { w: 1 } };
231237
}
232238

233239
// Accessors and methods Client-Side Encryption

0 commit comments

Comments
 (0)