MongoDB与SQL数据库有何不同

If you are familiar with MySQL or PostgreSQL for example, SQL databases allow you to add and retrieve data using a specific language, called SQL, that looks like this:

例如,如果您熟悉MySQL或PostgreSQL,则SQL数据库允许您使用一种称为SQL的特定语言来添加和检索数据,如下所示:

SELECT * FROM cars
INSERT INTO cars VALUES (fiesta, 2010)

SQL is rather old, being born in 1986, and it’s a battle-tested technology.

SQL很老,诞生于1986年,它是一项经过考验的技术。

Under the NoSQL umbrella we put all those databases that do not use the SQL language for querying the data.

NoSQL的保护下,我们放置了所有不使用SQL语言查询数据的数据库。

MongoDB falls under this umbrella.

MongoDB受此保护。

MongoDB is a document database. Instead of storing records, we store objects (called documents).

MongoDB是一个文档数据库 。 我们没有存储记录,而是存储对象(称为document )。

How does this differ from a SQL database? Tables in a SQL database are flat and static, they can host data but limited to what the original intent was (you can’t add a column dynamically) and to store complex data you need to create many tables and link the data in each table, following the relational databases common practices (like foreign keys, column types, etc).

这与SQL数据库有何不同? SQL数据库中的表是平面的静态的 ,它们可以承载数据,但限于原始意图(您不能动态添加列),并且要存储复杂的数据,需要创建许多表并在每个表中链接数据,遵循关系数据库的常规做法(例如外键,列类型等)。

In MongoDB you can store any object without having to worry about the particular fields that compose this object and how to store them. You tell MongoDB to store that object.

在MongoDB中,您可以存储任何对象,而不必担心组成该对象的特定字段以及如何存储它们。 您告诉MongoDB存储该对象。

With MongoDB, you don’t need to learn another language to interact with the data: you just call the JavaScript methods it exposes and that’s it (of course you can interact with it using other languages as well).

使用MongoDB,您无需学习另一种语言即可与数据进行交互:您只需调用它公开JavaScript方法即可(当然,您也可以使用其他语言与之交互)。

Data is stored in a format similar to JSON, but enhanced to allow storing more than just basic data types.

数据以类似于JSON的格式存储,但经过增强后可以存储的不仅仅是基本数据类型。

I hope this gives you a brief overview of the key differences between SQL databases and MongoDB.

我希望这能给您简要概述SQL数据库和MongoDB之间的主要区别。

翻译自: https://flaviocopes.com/mongodb-vs-sql/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值