Problem Summary
When using mongodb-sync-database, Debezium may serialize fullDocument as a JSON string (TextNode) instead of an ObjectNode. The current MongoJsonDebeziumDataChange.extractAfterRow() directly passes this TextNode to JsonNodeExtractUtil.extractAfterRow(), which expects an ObjectNode, causing ClassCastException or deserialization errors.
Root Cause
extractAfterRow() does not check if the fullDocument field is a TextNode. When it is a textual JSON string, it should be parsed into an ObjectNode first.
Proposed Changes
Add a check in extractAfterRow(): if dataNode is textual, parse it with ObjectMapper.readTree() before extracting row data.
Checklist
- Does it affect the original behavior: No
- Has unit tests been added: No
- Has document been added or modified: No Need
- Does it need to update dependencies: No
- Are there any changes that cannot be rolled back: No
Problem Summary
When using
mongodb-sync-database, Debezium may serializefullDocumentas a JSON string (TextNode) instead of an ObjectNode. The currentMongoJsonDebeziumDataChange.extractAfterRow()directly passes this TextNode toJsonNodeExtractUtil.extractAfterRow(), which expects an ObjectNode, causingClassCastExceptionor deserialization errors.Root Cause
extractAfterRow()does not check if thefullDocumentfield is a TextNode. When it is a textual JSON string, it should be parsed into an ObjectNode first.Proposed Changes
Add a check in
extractAfterRow(): ifdataNodeis textual, parse it withObjectMapper.readTree()before extracting row data.Checklist