explain Capture mode (Advanced) in MongoDB connect...
# replication-ask-ai
q
explain Capture mode (Advanced) in MongoDB connector source
k
In the MongoDB V2 source connector, “Capture mode (Advanced)” is the
update_capture_mode
setting. It controls how Airbyte obtains the value of a document when it is updated in CDC (change data capture) mode. [Mongo config ref; Terraform schema] You can choose: 1. Lookup (default) ◦ On an update event, Airbyte re-reads the current document from MongoDB. ◦ Safer default; does not require special MongoDB “post image” configuration. [Mongo config params; Terraform schema] 2. Post Image ◦ On an update event, Airbyte uses the “post image” from MongoDB’s change stream (the version of the document immediately after the update). [Mongo config params] ◦ Important requirements / risks: ▪︎ Only supported on MongoDB 6.0+. ▪︎ Collections must be configured to return pre and post images for change streams. [Mongo config params] ▪︎ If those settings are not correctly configured, severe data loss can occur (updates may be missed or incomplete). [Mongo config params] The knowledge sources do not provide further behavioral details beyond these descriptions and warnings. 👍 0 button 👎 0 button ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
q
@kapa.ai when i shoud use Post Image?
k
The knowledge sources only give limited guidance on when to use Post Image, but they do highlight its constraints and risks. From the docs: • Default is “Lookup” and is generally recommended; Post Image is an advanced option. [Mongo config params] • Post Image requirements: ◦ MongoDB 6.0+. ◦ Collections must be configured to return pre and post images for change streams. [Mongo config params] • The docs explicitly warn that “severe data loss will occur” if you choose Post Image without correctly configuring MongoDB for pre/post images. [Mongo config params] The documentation does not explicitly state concrete use cases where Post Image is preferable over Lookup, only that it “determines how Airbyte looks up the value of an updated document” and that Lookup is the default. [Mongo config params; Mongo config schema] So, based on the available docs: • Use Lookup by default. • Consider Post Image only if: ◦ You are on MongoDB 6.0+, ◦ You have correctly configured pre/post images on the relevant collections, and ◦ You specifically want Airbyte to read the exact post-update image from the change stream instead of re-reading the document via a lookup. [Mongo config params] Beyond this, the knowledge sources do not provide more detailed guidance on when Post Image is preferable. 👍 0 button 👎 0 button ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
q
if i only select some fields in collection when setup, does it reduce data when airbyte run cdc? @kapa.ai
k
Short answer: it reduces what is written to the destination, but not necessarily what is read from MongoDB. From the general schema configuration docs: • When you deselect a partial set of fields, Airbyte may still read all data from the source, but it will only write the selected fields to the destination. Deselecting fields “will not prevent Airbyte from reading them.” [Configuring schemas] For MongoDB V2 specifically: • In schema-enforced mode, Airbyte samples documents, builds a field list, and lets you deselect fields in the replication screen. [MongoDB replication] • In schema-less mode (schema enforcement disabled), each document is emitted as
{ "_id": ..., "data": { ...all fields... } }
and *you cannot deselect fields*; all fields are read and included. [MongoDB replication] The docs do not explicitly say that field selection changes the volume of data pulled from MongoDB’s change streams during CDC; they only guarantee reduced data written to the destination. So you should assume: • Field selection is mainly for controlling what lands in the destination / protecting PII, • Not a guaranteed way to reduce CDC read volume from MongoDB. 👍 0 button 👎 0 button ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.