What’s the best migration strategy to handle duplicate primary keys across different Realms?
In my legacy realm sync instance, I’m assigning each user their own realm and saving some common API data (like Food info) to those realms using the IDs from the API as the primary key (like a foodId). That means I have multiple legacy realms with objects that share a primary key.
This was fine pre-MongoDB Realm, but now since all user data is stored in collections, I can’t use those same primary keys without syncing issues. Unfortunately, users were able to mutate this data, so migrating it to a common partition is not an option.
What’s a good approach to migrating this data over without conflicts?
I’ve considered making my new schema contain both the API ID and an autogenerated _id. This would require me to make queries and updates client side with only the API ID and I wouldn’t get the benefits of primary key indexing. Is this my only option?