You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
724 B
JavaScript
30 lines
724 B
JavaScript
12 months ago
|
'use strict';
|
||
|
|
||
|
const utils = require('../../utils');
|
||
|
|
||
|
function applyGlobalMaxTimeMS(options, model) {
|
||
|
applyGlobalOption(options, model, 'maxTimeMS');
|
||
|
}
|
||
|
|
||
|
function applyGlobalDiskUse(options, model) {
|
||
|
applyGlobalOption(options, model, 'allowDiskUse');
|
||
|
}
|
||
|
|
||
|
module.exports = {
|
||
|
applyGlobalMaxTimeMS,
|
||
|
applyGlobalDiskUse
|
||
|
};
|
||
|
|
||
|
|
||
|
function applyGlobalOption(options, model, optionName) {
|
||
|
if (utils.hasUserDefinedProperty(options, optionName)) {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if (utils.hasUserDefinedProperty(model.db.options, optionName)) {
|
||
|
options[optionName] = model.db.options[optionName];
|
||
|
} else if (utils.hasUserDefinedProperty(model.base.options, optionName)) {
|
||
|
options[optionName] = model.base.options[optionName];
|
||
|
}
|
||
|
}
|