Skip to content

Commit 7b7e22b

Browse files
authored
Update id-validator.js
1 parent b5d0e1c commit 7b7e22b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/id-validator.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ 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)) {
66+
if (this && !!this.isModified && !this.isModified(path)) {
6767
return respond ? respond(true) : true
6868
}
6969
if (!(self instanceof IdValidator) || self.enabled) {
@@ -105,7 +105,7 @@ function executeQuery (query, conditions, validateValue, respond) {
105105
function 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

Comments
 (0)