2

When performing migration of legacy data to a springboot project it is sometimes crucial, to use the same Date for auditing fields such as createdDate and lastModifiedDate.

When using mongodb auditing, it is possible to override the createdDate with a custom date using @CreatedDate annotation.

However, the same is not true for @LastModifiedDate.

Mongodb auditing always saves the document with the actual Date the document was modified on instead of overriding it with the provided date.

Using @LastModifiedDate is there a way to save LastModifiedDate with the provided date similar to when using @CreatedDate?

Thanks

Jens Schauder
  • 77,657
  • 34
  • 181
  • 348
user2083529
  • 715
  • 3
  • 13
  • 25

0 Answers0