MongoDB.live, free & fully virtual. Register Now MongoDB.live, free & fully virtual. Register Now

How to get old record in atlas trigger

How we can get the old record in trigger with an update event.
I want this old record to maintain history.

Hi @2018_12049,

Triggers are defined to act on a change and not before a change. What I would suggest is to use triggers to move data from history to your live collection.

This means that you actually store your history data and most up to date records are pushed to your main collection via a trigger.

Best
Pavel