0

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.

Community
  • 1
  • 1
Zero
  • 717
  • 6
  • 21
  • 1
    I discuss transactions in mongodb here: http://stackoverflow.com/a/21887489/68567 – Will Shaver Nov 26 '14 at 18:39
  • I've checked out your link and your solution looks quite clever. But isn't this some sort of hack and using the right tool -- MySQL for the transactions -- the better approach to take? – Zero Nov 26 '14 at 18:53
  • You could argue that if you need transactions why split your data store at all? – Sammaye Nov 26 '14 at 19:17
  • Transactions -- cascade deletes -- will only be 1% of database activity, with the deletes happening infrequently. The other 99% of the time is when MongoDB seems a good fit. – Zero Nov 26 '14 at 20:32

2 Answers2

0

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/

Joe Murray
  • 585
  • 5
  • 21
0

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/

Grigori Melnik
  • 4,067
  • 2
  • 34
  • 40