Data Scientist/Back End Developer at Hiddenslate·
Needs advice
on
MongoDBMongoDB
and
MySQLMySQL

Hello everyone. We have a project that it's like a candidate tracking system. It has candidates, projects, assessments, etc. A consultant senior developer started it by using MongoDB. The thing is that he designed the database like it's a relational DB.

Personally, I didn't imagine that it was a good thing to do. Because you won't have the power of SQL functionalities like join, on delete, and more. You have to be very careful, I think things may go unmaintainable very fast. I asked him about this and he said "I don't see a problem doing it like this."

What are your thoughts on this? Did you see examples like this? Should I avoid it or go for it? Any advice is appreciated.

Here is what it looks like in Moon Modeler: https://imgur.com/a/RNwNBNY

READ LESS
5 upvotes·22.3K views
Replies (2)
Independent Information Technology and Services Professional at DR. YORAM KORNATZKY LTD·
Recommends
MySQL

It happened to me that you actually construct a relational schema with MongoDB. It is not good. You do not use the modeling benefits of MongoDB, and you do not have the benefits of SQL. So I recommend taking it into MySQL. Since you think in a relational way, it is best you move to MySQL

Specifically, do you need non-normalized data? If not, MySQL is best. Otherwise, MongoDB is best. If you think non-relational, you do not need joins, and the problems with cascade disappear.

What is the best way to think? If you work in terms of whole tree of related object, then you think non-relational and non-normalized.

READ MORE
6 upvotes·2 comments·21.6K views
Emre Emrah
Emre Emrah
·
May 28th 2022 at 3:54PM

Thanks for the advice. I want to ask you that in the most basic scenario we got `questionSet` which has an array of `question` in it. And a `question` can be used in different `questionSet`s. And for example when you update a `question`'s attribute (e.g. it's name), it should be updated in every `questionSet`. So clearly using foreign keys and relations is the best option here.

My question is: are there any real world problems that not like this? I think most databases have such relations. So when do people use nosql and why? I love MongoDB but I just need to clarify that.

I might ask this in a different question as well.

Edit: sorry that markdown seems to be not supported in comments.

·
Reply
Yoram Kornatzky
Yoram Kornatzky
·
May 29th 2022 at 10:21AM

What you describe points more into a relational model.

It is not always the case.

Think of Kanban boards, projects, and tasks. Conceptually it is a tree. In such a case, there is strong motivation to go non relational. NoSQL

·
Reply
CTO at Yatis Telematics·

It makes no sense if you use MongoDB primarily as a relational database. As you scale MongoDB will be more expensive than SQL and as you said without having the advantages of "join" etc.

We use MongoDB in our company. It is useful for us, as we work with different types of devices and we love the functionality of being able to add fields whenever we have a new device type etc. Mongo also allows enables easy scaling and fault tolerance. However, you will have to learn how to manage it.

If you are already comfortable with SQL and don't need NoSQL, stick to SQL. At scale, it is cheaper than Mongo.

READ MORE
2 upvotes·1.2K views
Avatar of Yoram Kornatzky

Yoram Kornatzky

Independent Information Technology and Services Professional at DR. YORAM KORNATZKY LTD