Hello, with MongoDB version 5.0, I can use change stream option 'full_document=‘updateLookup’ to get fullDocument of the inserted and updated documents but not for delete operations. For auditing purpose, I also need to put a record for deleted records and only documentKey in the change stream record is not sufficient? Does it require upgrade to version 6 to get the pre-image for delete operations?
I believe this is available since MongoDB 6.0. From Change Streams with Document Pre- and Post-Images:
Starting in MongoDB 6.0, you can use change stream events to output the version of a document before and after changes (the document pre- and post-images):
- The pre-image is the document before it was replaced, updated, or deleted. There is no pre-image for an inserted document.
- The post-image is the document after it was inserted, replaced, or updated. There is no post-image for a deleted document.
- Enable changeStreamPreAndPostImages for a collection using db.createCollection(), create, or collMod.