Fabrizzio Chavez created FLINK-38237:
----------------------------------------
Summary: MongoDB CDC - row_kind virtual column is returning
incorrect operation Type
Key: FLINK-38237
URL: https://issues.apache.org/jira/browse/FLINK-38237
Project: Flink
Issue Type: Bug
Components: Flink CDC
Affects Versions: cdc-3.4.0
Reporter: Fabrizzio Chavez
Attachments: Captura de pantalla 2025-08-10 a la(s) 20.30.58.png
Hello, I was exploring flink 1.20 and flink-connector-mongodb-cdc v3.4.0. The
steps I run in mongoDB are:
# Create a document
# Update it (expected beforeUpdate row_kind = -U)
# Delete it (expected delete row_kind = -D)
So the output was (see image below):
!Captura de pantalla 2025-08-10 a la(s) 20.30.58.png|width=1062,height=100!
You can see that when the op is -U the row_kind is +I, and when the op is -D
the row_kind returns +U.
This is the configuration behind these results:
{code:sql}
SET 'sql-client.execution.result-mode' = 'tableau';
CREATE TABLE mongo_users (
db_name STRING METADATA FROM 'database_name' VIRTUAL,
collection_name STRING METADATA FROM 'collection_name' VIRTUAL,
operation_ts TIMESTAMP_LTZ(3) METADATA FROM 'op_ts' VIRTUAL,
row_kind STRING METADATA FROM 'row_kind' VIRTUAL,
_id STRING,
name STRING,
PRIMARY KEY(_id) NOT ENFORCED
) WITH (
'connector' = 'mongodb-cdc',
'hosts' = 'localhost:27017',
'username' = 'admin',
'password' = 'admin',
'database' = 'cdc-test',
'collection' = 'users'
);
SELECT * FROM mongo_users;
{code}
I debugged the code and what the Enum MongoDBReadableMetadata returns when the
ROW_KIND is invoked and returns the right value, but when the value is
collected appears the differences mentioned above.
Regards,
Fabrizzio
--
This message was sent by Atlassian Jira
(v8.20.10#820010)