Skip to content

Commit 4c00abd

Browse files
committed
Keep existing updatedAt value
Addresses https://github.com/louischatriot/nedb/pull/629/files
1 parent 1a8eb0e commit 4c00abd

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lib/datastore.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,10 @@ class Datastore extends EventEmitter {
641641
const modifiedDoc = model.modify(candidates[i], updateQuery);
642642
if (this.timestampData) {
643643
modifiedDoc.createdAt = createdAt;
644-
modifiedDoc.updatedAt = new Date();
644+
// modifiedDoc.updatedAt = new Date();
645+
if (updateQuery.$set.updatedAt === undefined) {
646+
modifiedDoc.updatedAt = new Date();
647+
}
645648
}
646649
modifications.push({ oldDoc: candidates[i], newDoc: modifiedDoc });
647650
}

0 commit comments

Comments
 (0)