Skip to content

Commit

Permalink
fix(document): fix TypeError when setting a single nested subdoc with…
Browse files Browse the repository at this point in the history
… timestamps

Fix #8251
  • Loading branch information
vkarpov15 committed Oct 18, 2019
1 parent efd08ef commit 875d681
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/types/subdocument.js
Expand Up @@ -117,8 +117,11 @@ Subdocument.prototype.markModified = function(path) {

Subdocument.prototype.isModified = function(paths, modifiedPaths) {
if (this.$parent && this.$basePath) {
paths = (Array.isArray(paths) ? paths : paths.split(' ')).
map(p => [this.$basePath, p].join('.'));
if (Array.isArray(paths) || typeof paths === 'string') {
paths = (Array.isArray(paths) ? paths : paths.split(' '));
paths = paths.map(p => [this.$basePath, p].join('.'));
}

return this.$parent.isModified(paths, modifiedPaths);
}

Expand Down

0 comments on commit 875d681

Please sign in to comment.