View & Disable Collection-level Preimages¶
You can configure database triggers to include a document preimage in their change events. A preimage is a snapshot of a modified document from just before the modification was applied.
To support document preimages, Realm includes additional information in the linked cluster's oplog. This adds a small amount of storage overhead to each operation on the collection and may cause performance issues for collections with a high write throughput. Once you have enabled preimages for a collection, any trigger on the collection may enable document preimages with no additional overhead.
For information on how to enable document preimages for a specific trigger, see Create a Database Trigger.
View Preimage-Enabled Collections¶
To see a list of collections that are configured to store document preimages in their oplog, navigate to the Linked Data Source configuration screen and find the Preimage Preferences by Collection table.
The table lists every collection that stores preimages in the oplog. This includes all collections in the linked cluster, even if no triggers currently use the preimages for a collection or if the triggers are in a different Realm app.
Disable Preimages for a Collection¶
You can disable collection-level preimages in the Realm UI. Once disabled, the oplog no longer includes preimages for documents in the collection. To disable preimages for a collection:
- (Optional) Disable document preimages for all triggers on the collection.
When collection-level preimages are disabled, triggers on the collection that
still have preimages enabled (including triggers in other Realm apps) will
continue to execute but will not include the
fullDocumentBeforeChangefield in change events.
- Disable sync, if the collection is part of a synced cluster.
- On the linked cluster configuration screen, find the collection in the Preimage Preferences by Collection table and then click Disable.