什么是MongoDB?
MongoDB 是一个开源的面向文档的数据库,用于大容量数据存储。它属于 NoSQL 数据库的分类。 NoSQL 工具意味着它不使用通常的行和列。 MongoDB 使用 BSON(文档存储格式),它是 JSON 文档的二进制样式。
MongoDB的特点:
- 多服务器:它可以在多台服务器上运行。
- 无模式数据库:它是一个无模式数据库。
- 索引:文档中的任何字段都可以被索引。
- 富对象模型:支持丰富的对象模型。
- 什么是关系型数据库?
- 提供高水平的信息安全。
- 它快速而精确。
- 提供设施主键,对行进行异常区分。
它代表关系数据库管理系统。它以相关表的形式存储数据。
关系型数据库的特点:
RDBMS 和 MongoDB 的区别:
RDBMS | MongoDB |
---|---|
It is a relational database. | It is a non-relational and document-oriented database. |
Not suitable for hierarchical data storage. | Suitable for hierarchical data storage. |
It is vertically scalable i.e increasing RAM. | It is horizontally scalable i.e we can add more servers. |
It has a predefined schema. | It has a dynamic schema. |
It is quite vulnerable to SQL injection. | It is not affected by SQL injection. |
It centers around ACID properties (Atomicity, Consistency, Isolation, and Durability). | It centers around the CAP theorem (Consistency, Availability, and Partition tolerance). |
It is row-based. | It is document-based. |
It is slower in comparison with MongoDB. | It is almost 100 times faster than RDBMS. |
Supports complex joins. | No support for complex joins. |
It is column-based. | It is field-based. |
It does not provide JavaScript client for querying. | It provides a JavaScript client for querying. |
It supports SQL query language only. | It supports JSON query language along with SQL. |