Skip to content

Commit

Permalink
Check for empty schemaPath before accessing property $isMongooseDocum…
Browse files Browse the repository at this point in the history
…entArray

TypeError: Cannot read property '$isMongooseDocumentArray' of undefined.  Same issue as 8935a55
  • Loading branch information
randyhoulahan committed Feb 24, 2017
1 parent b3c99e6 commit b535012
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/services/updateValidators.js
Expand Up @@ -105,7 +105,7 @@ module.exports = function(query, schema, castedDoc, options) {
for (i = 0; i < numArrayUpdates; ++i) {
(function(i) {
var schemaPath = schema._getSchema(arrayUpdates[i]);
if (schemaPath.$isMongooseDocumentArray) {
if (schemaPath && schemaPath.$isMongooseDocumentArray) {
validatorsToExecute.push(function(callback) {
schemaPath.doValidate(
arrayAtomicUpdates[arrayUpdates[i]],
Expand Down

0 comments on commit b535012

Please sign in to comment.