Data Scientist/Back End Developer at Hiddenslate·
Needs advice

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:

5 upvotes·17.9K views
Replies (1)
Independent Information Technology and Services Professional at DR. YORAM KORNATZKY LTD·

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.

6 upvotes·2 comments·17.2K 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.

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

Avatar of Emre Emrah

Emre Emrah

Data Scientist/Back End Developer at Hiddenslate