我什么时候应该使用 mongoDB 而不是关系数据库

Chr*_*ola 3 mysql mongodb node.js express mern

我已经学习了 udemy 上的几门课程NodeJS/ExpressReactJS/Redux有些课程是MERN STACK而且我真的很喜欢它们。但是讲师没有真正解释的唯一一件事是选择。在MongoDB学习这些课程之前,我总是使用 ifPostgreSQLMariaBDfor all我的项目持久层。现在我刚刚MongoBD在所有这些课程中使用过,但不知道在哪种情况下它是最好的选择。所有的讲师都只是说,由于数据像 json json 数组一样存储,因此很容易解析为它自然地与Javascript任何其他项目兼容JSON format。我真的很想了解使用 Mongo 的技术原因,而relationnal database不是根据任何给定的项目要求而不是仅仅使用它,因为讲师这样做

小智 5

我曾在 SQL 和 MongoDB 方面工作过。

MongoDB

From my experience MongoDB is best suitable when you follow agile methodologies 
wherein you don't really know what your JSON object will have to contain.
Run Code Online (Sandbox Code Playgroud)

SQL

SQL will be best suitable where JSON object is not going to be changed, like 
for bank projects, where you know the exact format of JSON which is never going 
to be changed.
Run Code Online (Sandbox Code Playgroud)

差分法

Why I am saying this is, whenever we need to add some extra fields or need to 
link some fields with primary, foreign keys it would be pain and wouldn't know 
what could go wrong.

Wherein in MongoDB if you need to reference some field you will just need to 
add key ref with that field and you are done.
Run Code Online (Sandbox Code Playgroud)

MongoDB

MongoDB would be great when one of your key from one JSON object is to be 
referenced to mutiple JSON object by just adding that field name in ref (ref: 
'user')
Run Code Online (Sandbox Code Playgroud)

请投票这个答案,以便有需要的人找到这个答案,并了解 MongoDB 何时最适合他们。