Skip to content

Commit

Permalink
fix(timestamps): handle timestamps: false in child schema
Browse files Browse the repository at this point in the history
Fix #8007
  • Loading branch information
vkarpov15 committed Jul 26, 2019
1 parent 23d30e0 commit 3bf0bcc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/helpers/update/applyTimestampsToChildren.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function applyTimestampsToChildren(now, update, schema) {
createdAt = handleTimestampOption(timestamps, 'createdAt');
updatedAt = handleTimestampOption(timestamps, 'updatedAt');

if (updatedAt == null) {
if (!timestamps || updatedAt == null) {
continue;
}

Expand All @@ -110,6 +110,10 @@ function applyTimestampsToChildren(now, update, schema) {
createdAt = handleTimestampOption(timestamps, 'createdAt');
updatedAt = handleTimestampOption(timestamps, 'updatedAt');

if (!timestamps) {
continue;
}

if (updatedAt != null) {
update.$set[key][updatedAt] = now;
}
Expand Down

0 comments on commit 3bf0bcc

Please sign in to comment.