Goal: DevOps pipeline that will drop Collections in target system, then refresh them with an import from a source system.
I tried doing mongodump and mongorestore, but those break Device Sync replication, so not an option. Next idea was to just drop the data inside the Collections to preserve the schema, then restore from Source database. This would ensure the import would be a non-breaking change that would not break replication.
However, the problem with this is the index still preserves the old values from the original data.
error: E11000 duplicate key error collection: __realm_sync_63750a5292e8ebc57ad100ee.client_meta_version_counter index: _id_ dup key:
Dropping the index would be a Breaking change, and MongoDB doesn’t let you drop an index with ID in it anyway.
So I’m not sure what the best path forward here is. If there is a way to “clear” the index without dropping it, that would be great. If that’s not possible, any other suggestions would be appreciated. These are small config tables, so we thought it was a cleaner path forward to move the entire table between environments, instead of trying to piece them together with updates, inserts, etc.
Thanks for any help.