<!-- llms-explorer concept facts · https://llms-explorer.com/tree/change-stream-point-in-time-images-and-retention-lifecycle/ · pack 2026-10-27 · ~1642 tokens -->

# Change-stream point-in-time images and retention lifecycle

> Source-anchored research for Change-stream point-in-time images and retention lifecycle. Run status: COMPLETED.

Parent: [MongoDB Replication](https://llms-explorer.com/tree/mongodb-replication/) · 4 facets · 18 facts · page: https://llms-explorer.com/tree/change-stream-point-in-time-images-and-retention-lifecycle/

## How it works

- A background process removes expired pre-images from config.system.preimages asynchronously. Expiration makes images eligible for cleanup; it is not a promise that physical deletion happens at the exact expiry second. (high confidence) — [source](https://www.mongodb.com/docs/manual/changeStreams.md)
- Pre-images occupy config.system.preimages, and a background process removes them asynchronously. Enabling image capture consumes additional storage and processing time. (medium confidence) — [source](https://www.mongodb.com/docs/manual/changeStreams.md)
- Treat lookup-derived before/after comparisons cautiously: rapid updates can make an event delta and its looked-up full document represent different operations. Prefer point-in-time post-images when exact per-update document states are required. (medium confidence) — [source](https://debezium.io/documentation/reference/stable/connectors/mongodb.html)

## Problems, failure modes and limitations

- Image recording must be enabled on each collection with changeStreamPreAndPostImages before the operation occurs. create, db.createCollection(), and collMod support enabling it; enabling it later cannot supply images for earlier operations. (high confidence) — [source](https://www.mongodb.com/docs/manual/changeStreams.md)
- Request pre-images with fullDocumentBeforeChange and post-images with fullDocument. For each option, whenAvailable permits null for an unavailable image, whereas required terminates the stream with an error if the required image is missing. (low confidence) — [source](https://github.com/mongodb/mongo/blob/master/docs/change_streams.md)
- Enabling images adds storage and processing work. Including full images also enlarges change events; Airbyte and Debezium warn that large events can exceed the 16 MiB BSON limit and fail. Image capture therefore requires both retention and event-size planning. (high confidence) — [source](https://www.mongodb.com/docs/manual/changeStreams.md)
- Request pre-images with fullDocumentBeforeChange. For both image options, "required" raises an error when the requested image is unavailable, whereas "whenAvailable" returns the image only if available; fullDocumentBeforeChange defaults to "off". (medium confidence) — [source](https://www.mongodb.com/docs/manual/reference/method/db.collection.watch.md)
- Removing an event from the oplog also makes its corresponding images subject to deletion regardless of a longer expireAfterSeconds setting. An image retention setting cannot extend image history beyond the associated oplog history. (medium confidence) — [source](https://www.mongodb.com/docs/manual/reference/cluster-parameters/changeStreamOptions.md)
- Returning full images increases event size. Large documents combined with image fields and event metadata can exceed the 16 MiB BSON event limit, including when a lookup returns the full document. (medium confidence) — [source](https://www.mongodb.com/docs/manual/changeStreams.md)

## Comparisons and alternatives

- fullDocument: updateLookup reads the current majority-committed document rather than guaranteeing the event-time document. Intervening updates can change its contents; a later deletion can make the lookup return null. Airbyte documents that multiple events can consequently contain the same final state. (high confidence) — [source](https://www.mongodb.com/docs/manual/changeStreams.md)
- For update events, fullDocument: "whenAvailable" or "required" requests the point-in-time post-image. This supports consumers that need intermediate document states instead of the latest document version returned by lookup. (medium confidence) — [source](https://www.mongodb.com/docs/manual/reference/method/db.collection.watch.md)

## Facts and statements

- Pre-images represent documents before update, replacement, or deletion; inserts have no pre-image. Post-images represent documents after insert, replacement, or update; deletes have no post-image. (high confidence) — [source](https://www.mongodb.com/docs/manual/changeStreams.md)
- For update events, MongoDB's implementation reconstructs point-in-time post-images from the stored pre-image and the event's update delta. It does not need to store a second full post-image for each update. (low confidence) — [source](https://github.com/mongodb/mongo/blob/master/docs/change_streams.md)
- changeStreamOptions.preAndPostImages.expireAfterSeconds controls image retention cluster-wide. Its default off ties retention to the corresponding oplog events; off does not mean indefinite retention. Oplog eviction expires associated images regardless of a longer configured image-retention interval. (high confidence) — [source](https://www.mongodb.com/docs/manual/reference/cluster-parameters/changeStreamOptions.md)
- Budget image retention for consumer lag and recovery time, and monitor oplog history separately. An event can remain readable after its required image expires, so event availability alone does not guarantee image availability. (high confidence) — [source](https://www.mongodb.com/docs/manual/reference/cluster-parameters/changeStreamOptions.md)
- The historical C# driver issue CSHARP-4801 reproduced an expired pre-image causing FullDocumentBeforeChange access to cast BsonNull to BsonDocument and throw. The issue records fix version 2.22.0; it is evidence of a historical driver null-handling bug, not a current server retention defect. (low confidence) — [source](https://jira.mongodb.org/browse/CSHARP-4801)
- MongoDB 6.0 introduced configurable change-stream pre- and post-images. A pre-image describes the document before an update, replacement, or deletion; a post-image describes it after insertion, replacement, or update. Inserts have no pre-image and deletes have no post-image. (medium confidence) — [source](https://www.mongodb.com/docs/manual/changeStreams.md)
- changeStreamOptions.preAndPostImages.expireAfterSeconds controls image retention cluster-wide. Its default "off" ties retention to the corresponding oplog events; it does not mean indefinite archival retention. (medium confidence) — [source](https://www.mongodb.com/docs/manual/reference/cluster-parameters/changeStreamOptions.md)
