I have 2 instances of Java server running in a docker along with the MongoDB database. We use mongock to migrate the MongoDB data which works fine. I have developed a feature where user can export specific data from the MongoDB from one instance and can import into another instance. The problem arises when the above-mentioned instances are not on the same version,
- Source instance version is greater than destination instance: Import-export is not possible as source instance might have enhanced features which destination instance is not yet introduced to
- Source instance is lower than destination instance: This imported data should be automatically migrated to the latest version so that destination instance can make sense out of it
I'm looking to address the 2nd case specifically. I tried to look for this kind of specific use case but was unable to find any relevant example.