Change stream fullDocument on delete

Hi @Ivan_Lysov,

Welcome to MongoDB community!

So there is a nice workaround I presented for Atlas triggers. Since they are based on change stream events eventually same one can be applied to your scenario.

The main Idea in the linked post is:

  1. There is a new expireField with 0 life time ttl on it.
  2. When you want to delete a document you actually set this field to current time.
  3. Your change stream event listen to an update where the expiry field is present and specify full document.
  4. The change stream will perform the needed operation and ttl will meanwhile delete that document.

To me this is the most elegant way I can think of.

Let me know if that helps

Thanks
Pavel

2 Likes