This commit is contained in:
2020-08-20 11:44:32 +02:00
parent 4715fc1814
commit 6aceefeb2f
2891 changed files with 11239 additions and 347539 deletions

View File

@@ -1,5 +1,7 @@
'use strict';
const kWriteConcernKeys = new Set(['w', 'wtimeout', 'j', 'fsync']);
/**
* The **WriteConcern** class is a class that represents a MongoDB WriteConcern.
* @class
@@ -51,6 +53,14 @@ class WriteConcern {
}
if (options.writeConcern) {
if (typeof options.writeConcern === 'string') {
return new WriteConcern(options.writeConcern);
}
if (!Object.keys(options.writeConcern).some(key => kWriteConcernKeys.has(key))) {
return;
}
return new WriteConcern(
options.writeConcern.w,
options.writeConcern.wtimeout,