Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does it make sense to use BOTH mongodb and mysql in the same rails application?

Tags:

I have a good reason to use MongoDB for part of my app. But people generally describe it as not a good fit for "transactional" applications like a bank where transactions have to be exact/consistent, etc.

Does it make sense to split the models up in Rails and have some of them use MySql and others mongo? Or will this generally cause more problems than it's worth?

I'm not building a banking app or anything but was thinking it might make sense for my user's table or transactions table (recording revenue) to do that part in MySql.

like image 368
Brian Armstrong Avatar asked Mar 19 '10 06:03

Brian Armstrong


People also ask

Can I use both MySQL and MongoDB?

It's common to use MySQL as the primary storage and MongoDB as caching/intermediate storage for speed. You can for example have read-intensive data in MongoDB. The data for generating reports is perfect for a relational system like MySQL.

Can we use MongoDB with rails?

Read More: How to install and use MongoDB with Rails 6Create a new rails application to use Ruby MongoDB. Make sure that you add –skip-active-record. If you notice, there is no database. yml and no sqlite3 gem is added automatically.

Why should I use MongoDB and not MySQL with node?

Even though Node. js works well with MySQL database, the perfect combination is a NoSQL like MongoDB wherein the schema need not be well-structured. MongoDB represents the data as a collection of documents rather than tables related by foreign keys.

How do I choose between MongoDB and MySQL database?

MySQL is a good choice if you are working with a legacy application that requires multi-row transactions and has structured data with a clear schema. MongoDB is a good choice if: You want high data availability along with automatic and instant data recovery.


1 Answers

That's what we do with CouchDB and PostgreSQL.

All our users and groups kinds of things are in the postgresql database.
Anything else (in our case, some records with statistical datas) are in the couchdb database.

In our case, it allows us to have one couchdb database per client (the app connects itself to one or an other depending of the user's host).
And only one postgresql database having all the users in it.

So yes I think it's a good idea to have a SQL and a NOSQL database in the same application.

like image 58
Damien MATHIEU Avatar answered Oct 24 '22 02:10

Damien MATHIEU