Cleanup
This commit is contained in:
23
node_modules/mongodb/lib/gridfs/grid_store.js
generated
vendored
23
node_modules/mongodb/lib/gridfs/grid_store.js
generated
vendored
@@ -73,10 +73,11 @@ const deprecationFn = deprecate(() => {},
|
||||
* @param {string} [filename] optional filename for this file, no unique constrain on the field
|
||||
* @param {string} mode set the mode for this file.
|
||||
* @param {object} [options] Optional settings.
|
||||
* @param {(number|string)} [options.w] The write concern.
|
||||
* @param {number} [options.wtimeout] The write concern timeout.
|
||||
* @param {boolean} [options.j=false] Specify a journal write concern.
|
||||
* @param {boolean} [options.fsync=false] Specify a file sync write concern.
|
||||
* @param {(number|string)} [options.w] **Deprecated** The write concern. Use writeConcern instead.
|
||||
* @param {number} [options.wtimeout] **Deprecated** The write concern timeout. Use writeConcern instead.
|
||||
* @param {boolean} [options.j=false] **Deprecated** Specify a journal write concern. Use writeConcern instead.
|
||||
* @param {boolean} [options.fsync=false] **Deprecated** Specify a file sync write concern. Use writeConcern instead.
|
||||
* @param {object|WriteConcern} [options.writeConcern] Specify write concern settings.
|
||||
* @param {string} [options.root] Root collection to use. Defaults to **{GridStore.DEFAULT_ROOT_COLLECTION}**.
|
||||
* @param {string} [options.content_type] MIME type of the file. Defaults to **{GridStore.DEFAULT_CONTENT_TYPE}**.
|
||||
* @param {number} [options.chunk_size=261120] Size for the chunk. Defaults to **{Chunk.DEFAULT_CHUNK_SIZE}**.
|
||||
@@ -153,6 +154,7 @@ var GridStore = function GridStore(db, id, filename, mode, options) {
|
||||
},
|
||||
set: function(value) {
|
||||
if (!(this.mode[0] === 'w' && this.position === 0 && this.uploadDate == null)) {
|
||||
// eslint-disable-next-line no-self-assign
|
||||
this.internalChunkSize = this.internalChunkSize;
|
||||
} else {
|
||||
this.internalChunkSize = value;
|
||||
@@ -1571,12 +1573,13 @@ var _writeNormal = function(self, data, close, options, callback) {
|
||||
* @ignore
|
||||
*/
|
||||
var _setWriteConcernHash = function(options) {
|
||||
const baseOptions = Object.assign(options, options.writeConcern);
|
||||
var finalOptions = {};
|
||||
if (options.w != null) finalOptions.w = options.w;
|
||||
if (options.journal === true) finalOptions.j = options.journal;
|
||||
if (options.j === true) finalOptions.j = options.j;
|
||||
if (options.fsync === true) finalOptions.fsync = options.fsync;
|
||||
if (options.wtimeout != null) finalOptions.wtimeout = options.wtimeout;
|
||||
if (baseOptions.w != null) finalOptions.w = baseOptions.w;
|
||||
if (baseOptions.journal === true) finalOptions.j = baseOptions.journal;
|
||||
if (baseOptions.j === true) finalOptions.j = baseOptions.j;
|
||||
if (baseOptions.fsync === true) finalOptions.fsync = baseOptions.fsync;
|
||||
if (baseOptions.wtimeout != null) finalOptions.wtimeout = baseOptions.wtimeout;
|
||||
return finalOptions;
|
||||
};
|
||||
|
||||
@@ -1590,6 +1593,7 @@ var _getWriteConcern = function(self, options) {
|
||||
|
||||
// Local options verification
|
||||
if (
|
||||
options.writeConcern != null ||
|
||||
options.w != null ||
|
||||
typeof options.j === 'boolean' ||
|
||||
typeof options.journal === 'boolean' ||
|
||||
@@ -1601,6 +1605,7 @@ var _getWriteConcern = function(self, options) {
|
||||
} else if (typeof options.safe === 'boolean') {
|
||||
finalOptions = { w: options.safe ? 1 : 0 };
|
||||
} else if (
|
||||
self.options.writeConcern != null ||
|
||||
self.options.w != null ||
|
||||
typeof self.options.j === 'boolean' ||
|
||||
typeof self.options.journal === 'boolean' ||
|
||||
|
||||
Reference in New Issue
Block a user