当前位置:网站首页>史上最全MongoDB之初识篇
史上最全MongoDB之初识篇
2022-07-06 21:33:00 【janyxe】
MongoDB系列文章目录
如果本文对你们的开发之路有所帮助,请帮忙点个赞,您的支持是我坚持写博客的动力
前言
本系列课程将带着大家以面试题的方式 深入分布式专题之MongoDB。这篇文章带着大家初识MongoDB
什么是MongoDB
- MongoDB是一个基于 分布式文件存储 的数据库。由C++语言编写。
- 支持的数据结构非常松散,数据格式是 BSON
- 支持动态查询
- 支持复制和故障恢复
- 支持 Golang,RUBY,PYTHON,JAVA,C++,PHP,C#等多种语言
BSON(binary json)与JSON的区别
- Binary JSON ,和JSON一样支持内嵌的文档对象和数组对象,因此可以存储比较复杂的数据类型
- BSON 具有更快的遍历速度
- BSON 操作更简易
- BSON 增加了额外的数据类型
MongoDB 历史版本
- 2012年05月23日,MongoDB2.1 开发分支发布了! 该版本采用全新架构,包含诸多增强。
- 2012年06月06日,MongoDB 2.0.6 发布,分布式文档数据库。
- 2013年04月23日,MongoDB 2.4.3 发布,此版本包括了一些性能优化,功能增强以及bug修复。
- 2013年08月20日,MongoDB 2.4.6 发布。
- 2013年11月01日,MongoDB 2.4.8 发布。
- 2017年03月17日,MongoDB 3.0.1发布。
- 2018年08月06日,MongoDB 4.0.2发布,支持多文档事务。
- 2019年08月13日,MongoDB 4.2.0 发布 ,引入分布式事务。
MongoDB 与关系型数据库(RDBMS)对比
共同点
| 关系型数据库(RDBMS) | MongoDB |
|---|---|
| 数据库(database) | 数据库(database) |
| 表(table) | 集合(collection) |
| 行(row) | 文档(document) |
| 列(column) | 字段(field) |
| 索引(index) | 索引(index) |
| 主键(primary key) | _id(字段) |
| 视图(view) | 视图(view) |
| 表链接(table join) | 聚合操作($lookup) |
不同点
- MongoDB具有半结构化特点。不需要进行字段声明,且集合中字段不需要完全相同
- MongoDB没有外键约束,表连接需要使用聚合管道技术($lookup)实现
MongoDB 名称解释
| 名词 | 解释 |
|---|---|
| 数据库(database) | 可以理解为逻辑上的名称空间,一个数据库包含多个不同名称的集合 |
| 集合(collection) | 相当于*关系型数据库(RDBMS)*中的表 |
| 文档(document) | 一个文档相当于数据表中的一行,由多个不同的字段组成 |
| 字段(field) | 文档中的一个属性,等同于关系型数据库(RDBMS) 的 列(column) |
| 索引(index) | 独立的检索式数据结构,与SQL概念一致 |
| _id | 每个文档中都拥有一个唯一的id字段 |
| 视图(view) | 虚拟的(非真实存在的)集合,与SQL中的视图类似,其通过聚合管道技术实现 |
| 聚合操作($lookup) | 用于实现"类似"表连接(tablejoin)的聚合操作符 |
MongoDB 相比其他数据库的优势
- 文档存储
MongoDB 采用BSON/JSON文档存储数据 - 扩展性高且高可用
MongoDB 支持数据分片,复制集提供99.999%高可用 - 易于查询
JSON 结构和对象模型接近,开发代码量低 - 安全性高
MongoDB客户端生成的查询为BSON对象,降低了SQL注入的攻击的危险
边栏推荐
- 中青杯2022A题高校数学建模竞赛与课程教育思路分析
- 运算放大器应用汇总1
- Web service performance monitoring scheme
- [leetcode] 700 and 701 (search and insert of binary search tree)
- AVL树插入操作与验证操作的简单实现
- Termux set up the computer to connect to the mobile phone. (knock the command quickly), mobile phone termux port 8022
- 再AD 的 界面顶部(菜单栏)创建常用的快捷图标
- 机器学习笔记 - 使用机器学习进行鸟类物种分类
- Implementation steps of docker deploying mysql8
- When QT uses qtooltip mouse to display text, the picture of the button will also be displayed and the prompt text style will be modified
猜你喜欢

Clock in during winter vacation

Mysql-数据丢失,分析binlog日志文件

VHDL implementation of arbitrary size matrix multiplication

Tencent cloud native database tdsql-c was selected into the cloud native product catalog of the Academy of communications and communications

Baidu map JS development, open a blank, bmapgl is not defined, err_ FILE_ NOT_ FOUND

idea gradle lombok 报错集锦

Free PHP online decryption tool source code v1.2

Storage of data

When QT uses qtooltip mouse to display text, the picture of the button will also be displayed and the prompt text style will be modified
![[security attack and Defense] how much do you know about serialization and deserialization?](/img/1c/e5ae74e65bacf688d7f61cc1b71d3e.png)
[security attack and Defense] how much do you know about serialization and deserialization?
随机推荐
Summer 2022 daily question 1 (1)
A 股指数成分数据 API 数据接口
C task expansion method
Construction of Hisilicon universal platform: color space conversion YUV2RGB
HW-小记(二)
你心目中的数据分析 Top 1 选 Pandas 还是选 SQL?
2022电工杯A题高比例风电电力系统储能运行及配置分析思路
ERROR: Could not build wheels for pycocotools which use PEP 517 and cannot be installed directly
Redis源码学习(31),字典学习,dict.c(一)
Force buckle ----- path sum III
Some thoughts on cross end development of kbone and applet
cuda编程
【编码字体系列】OpenDyslexic字体
List interview common questions
The true face of function pointer in single chip microcomputer and the operation of callback function
数据的存储
PHP 实现根据概率抽奖
Some common software related
10 ways of interface data security assurance
使用Thread类和Runnable接口实现多线程的区别