Have you managed to move from Mongo (or some other NoSQL / NoSchema database) to an RDBMS? What considerations did you have to make? Any traps or pitfalls?
It seems to me there are two basic approaches:
1. Create migrations for the data, and rewrite all queries. Test thoroughly, then flip the switch and move everything to the new DB
2. Create migrations, then keep the two databases in sync while rewriting queries, until all queries are migrated and Mongo can be turned off.
Approach (1) seems both difficult and risky, but means I don't have to keep data in sync, which seems to me to be the big risk of approach (2).
I'd love to hear your thoughts!
2) all reads from Mongo
3) in the background start data migration, one key/document at a time; transform Mongo document into RDBMS table/rows and insert... have mongo document id as primary key for main table... for every document migration/insert, lock the corresponding RDBMS row, this will ensure data consistency...
4) create code path to read from RDBMS.
5) test it in stage for different fail-case scenarios...
6) ideally, do canary type push to single server etc in prod to see if read from RDBMS seems fine (this assumes #3 is done)
actual steps may vary... but these are high-level steps....hope it helps...