Cleanup
This commit is contained in:
28
node_modules/mongoose/lib/helpers/schema/applyWriteConcern.js
generated
vendored
28
node_modules/mongoose/lib/helpers/schema/applyWriteConcern.js
generated
vendored
@@ -4,13 +4,27 @@ const get = require('../get');
|
||||
|
||||
module.exports = function applyWriteConcern(schema, options) {
|
||||
const writeConcern = get(schema, 'options.writeConcern', {});
|
||||
if (!('w' in options) && writeConcern.w != null) {
|
||||
options.w = writeConcern.w;
|
||||
if (Object.keys(writeConcern).length != 0) {
|
||||
options.writeConcern = {};
|
||||
if (!('w' in options) && writeConcern.w != null) {
|
||||
options.writeConcern.w = writeConcern.w;
|
||||
}
|
||||
if (!('j' in options) && writeConcern.j != null) {
|
||||
options.writeConcern.j = writeConcern.j;
|
||||
}
|
||||
if (!('wtimeout' in options) && writeConcern.wtimeout != null) {
|
||||
options.writeConcern.wtimeout = writeConcern.wtimeout;
|
||||
}
|
||||
}
|
||||
if (!('j' in options) && writeConcern.j != null) {
|
||||
options.j = writeConcern.j;
|
||||
}
|
||||
if (!('wtimeout' in options) && writeConcern.wtimeout != null) {
|
||||
options.wtimeout = writeConcern.wtimeout;
|
||||
else {
|
||||
if (!('w' in options) && writeConcern.w != null) {
|
||||
options.w = writeConcern.w;
|
||||
}
|
||||
if (!('j' in options) && writeConcern.j != null) {
|
||||
options.j = writeConcern.j;
|
||||
}
|
||||
if (!('wtimeout' in options) && writeConcern.wtimeout != null) {
|
||||
options.wtimeout = writeConcern.wtimeout;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
4
node_modules/mongoose/lib/helpers/schema/cleanPositionalOperators.js
generated
vendored
4
node_modules/mongoose/lib/helpers/schema/cleanPositionalOperators.js
generated
vendored
@@ -7,6 +7,6 @@
|
||||
|
||||
module.exports = function cleanPositionalOperators(path) {
|
||||
return path.
|
||||
replace(/\.\$(\[[^\]]*\])?\./g, '.0.').
|
||||
replace(/\.(\[[^\]]*\])?\$$/g, '.0');
|
||||
replace(/\.\$(\[[^\]]*\])?(?=\.)/g, '.0').
|
||||
replace(/\.\$(\[[^\]]*\])?$/g, '.0');
|
||||
};
|
||||
12
node_modules/mongoose/lib/helpers/schema/merge.js
generated
vendored
12
node_modules/mongoose/lib/helpers/schema/merge.js
generated
vendored
@@ -1,7 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function merge(s1, s2) {
|
||||
s1.add(s2.tree || {});
|
||||
module.exports = function merge(s1, s2, skipConflictingPaths) {
|
||||
const paths = Object.keys(s2.tree);
|
||||
const pathsToAdd = {};
|
||||
for (const key of paths) {
|
||||
if (skipConflictingPaths && (s1.paths[key] || s1.nested[key] || s1.singleNestedPaths[key])) {
|
||||
continue;
|
||||
}
|
||||
pathsToAdd[key] = s2.tree[key];
|
||||
}
|
||||
s1.add(pathsToAdd);
|
||||
|
||||
s1.callQueue = s1.callQueue.concat(s2.callQueue);
|
||||
s1.method(s2.methods);
|
||||
|
||||
Reference in New Issue
Block a user