You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
614 B
28 lines
614 B
'use strict';
|
|
|
|
/*!
|
|
* ignore
|
|
*/
|
|
|
|
module.exports = function(schema) {
|
|
// `this.$__.validating` tracks whether there are multiple validations running
|
|
// in parallel. We need to clear `this.$__.validating` before post hooks for gh-8597
|
|
const unshift = true;
|
|
schema.s.hooks.post('validate', false, function() {
|
|
if (this.$isSubdocument) {
|
|
return;
|
|
}
|
|
|
|
this.$__.validating = null;
|
|
}, unshift);
|
|
|
|
schema.s.hooks.post('validate', false, function(error, res, next) {
|
|
if (this.$isSubdocument) {
|
|
next();
|
|
return;
|
|
}
|
|
|
|
this.$__.validating = null;
|
|
next();
|
|
}, unshift);
|
|
};
|