@@ -63,8 +63,8 @@ IdValidator.prototype.validateSchema = function (
6363 validator : function ( value , respond ) {
6464 var conditionsCopy = conditions
6565 //A query may not implement an isModified function.
66- if ( ! ! this . isModified && ! this . isModified ( path ) ) {
67- return respond ( true )
66+ if ( this && ! ! this . isModified && ! this . isModified ( path ) ) {
67+ return respond ? respond ( true ) : true
6868 }
6969 if ( ! ( self instanceof IdValidator ) || self . enabled ) {
7070 if ( Object . keys ( conditionsCopy ) . length > 0 ) {
@@ -81,7 +81,7 @@ IdValidator.prototype.validateSchema = function (
8181 return validateFunction ( this , connection , refModelName ,
8282 value , conditionsCopy , respond , allowDuplicates )
8383 }
84- return respond ( true )
84+ return respond ? respond ( true ) : true
8585 } ,
8686 isAsync : true ,
8787 message : message
@@ -105,7 +105,7 @@ function executeQuery (query, conditions, validateValue, respond) {
105105function validateId (
106106 doc , connection , refModelName , value , conditions , respond ) {
107107 if ( value == null ) {
108- return respond ( true )
108+ return respond ? respond ( true ) : true
109109 }
110110 var refModel = connection . model ( refModelName )
111111 var query = refModel . countDocuments ( { _id : value } )
@@ -116,7 +116,7 @@ function validateIdArray (
116116 doc , connection , refModelName , values , conditions , respond ,
117117 allowDuplicates ) {
118118 if ( values == null || values . length == 0 ) {
119- return respond ( true )
119+ return respond ? respond ( true ) : true
120120 }
121121
122122 var checkValues = values
0 commit comments