MongoDB as main datastore, MySQL for transactions only

120 views Asked by At

I'm having difficulty finding good sources of information on how to solve this problem. Most search results, both here on SO and outside, come up MongoDB versus MySQL rather than MongoDB with MySQL. Database design isn't really my strongest forte -- I've never deployed any sort of database to production -- and I prefer MongoDB simply because it's so much easier to learn and work with and I got the most familiarity with it. My question is thus, how would I go about setting up this sort of environment where Node.js is the language and I want to use MongoDB as the main database and MySQL just for transactions or specifically, to enforce consistency and data integrity in the MongoDB database?

EDIT: Database activity will be 1% transactions for cascade delete operations with the deletes happening infrequently. The other 99% of the time is where I believe MongoDB will be a good fit.

2

There are 2 answers

0
Joe Murray On

You may want to consider using the NoSQL engines in MySQL along with the ACID compliant traditional rdbms engine, InnoDB. See http://www.mysql.com/why-mysql/white-papers/guide-to-mysql-and-nosql-delivering-the-best-of-both-worlds/

0
Grigori Melnik On

MongoDB 4.0 will address that 1% of scenarios you are discussing here - it will support multi-document ACID transactions, including cascade deletes. See https://docs.mongodb.com/manual/upcoming/