e-mhui opened a new pull request, #7960: URL: https://github.com/apache/inlong/pull/7960
### Prepare a Pull Request [INLONG-7958][Sort] Fix MongoDB's schema becomes unordered after extracting the row data - Fixes #7958 ### Motivation 1. MongoDB's schema becomes unordered after extracting the row data <img width="1427" alt="image" src="https://user-images.githubusercontent.com/111486498/236597820-c6eb1783-8786-4194-9c39-2da8d2d89f85.png"> 2. For all database migration, Mognodb CDC does not specify a primary key, so **upsert** cannot be implemented. Refer to https://ververica.github.io/flink-cdc-connectors/master/content/connectors/mongodb-cdc.html, we should specify `_id` as the default primary key. > MongoDB’s change event record doesn’t have updated before message. So, we can only convert it to Flink’s UPSERT changelog stream. An upsert stream requires a unique key, so we must declare _id as primary key. We can’t declare other column as primary key, because delete operation does not contain the key and value besides _id and sharding key. ### Modifications 1. Use `LinkedHashMap` instead of `HashMap` to make the schema ordered. 2. Use `_id` as the default primary key 3. Refactor the code -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
