I'm having trouble adding an header from a document field (not metadata), which I'm able to do using the ExtractNewRecordState SMT on Postgres, but not using ExtractNewDocumentState on MongoDb.
This is the configuration which allows me to copy a non metadata field to a header using ExtractNewRecordState (by reaching into the "after" object):
"transforms": "unwrap",
"transforms.unwrap.type": "io.debezium.transforms.ExtractNewRecordState",
"transforms.unwrap.add.headers": "after.Id:Id",
"transforms.unwrap.add.headers.prefix": "",
If I try the same configuration using the ExtractNewDocumentState SMT for MongoDb, it doesn't work:
"transforms": "unwrap",
"transforms.unwrap.type":"io.debezium.connector.mongodb.transforms.ExtractNewDocumentState",
"transforms.unwrap.add.headers": "after.Id:Id",
"transforms.unwrap.add.headers.prefix": "",
I get the following error:
java.lang.IllegalArgumentException: Unexpected field name: after.Id
I suspect it has to with the type of the "after" object being a string, instead of an object (as in Postgres), so at this point the SMT is not able to reach into the object to get the fields.
From what I've seen there is no SMT available for copying a field into a header, so how can I overcome this issue?