Where to use MongoDB and where is MySQL?

I am thinking of using one of two databases - MySQL and MongoDB. I plan to store text and numeric data, and I will create my application in RoR.

So, I do not know which database system could be better for this purpose - can you help me, please, by what criteria will I decide?

+6
source share
5 answers

Let me ask this question in more general terms and in some historical perspective.

In the 1960s, they asked if a hierarchical or network database should be used.

In the 70s the debate was related to the network

In the 80s, Relational turned into SQL databases, so the question mutated in SQL vs. network

In the 90s, it was SQL against object databases

In 00s, it was SQL versus XML Databases

Today we have SQL vs. NoSQL

Do you see a sample here? Do you still put some money on a competitor SQL, especially if it is nothing more than an illustrious hash table?

+12
source

In my projects, I also used MySQL and MongoDB with Mongoid, and I can say that if you want to store binary data in your database, such as images, mp3 and other materials, try Mongo, for other reasons you can use SQL databases, MongoDB has no structure - you process a hash so that you can dynamically add and remove keys / columns.
In your case, I would use MySQL.

+4
source

In my opinion, you should base your decision on the purpose of your application. You want to search your text data as you define the keys. For MySQL, you need to use a little if you need to query each record and scan it. Even if there are functions for performing text scans in MySQL (does it have?) MongoDB will probably do the job more efficiently. Otherwise, if you are not going to use the strengths of MongoDB, you can also go for MySQL.

Another factor may be the deadline for implementing something. If you need it quickly, do not waste time learning something new. If you have time to experiment, find out the key features that you most likely rely on in your application.

+2
source

I think if you need a rigid structure, you should use MySQL because it is its nature, but if you need something more dynamic, with no structure at all (no scheme), you should use MongoDB, I never use MongoDB, but I know that it is more focused on an object / document.

+1
source

It would be helpful if you could provide more detailed information. Can your data fit easily into the schema, or do you need the flexibility that document storage offers? How about auto-shards, etc.? Without additional information, no one can give you advice that suits your needs. If this is not done, you cannot hope for feedback better than personal preferences of people, which is nothing more than the expected flamewar event.

+1
source

Source: https://habr.com/ru/post/886903/


All Articles