当前位置:网站首页>史上最全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注入的攻击的危险
边栏推荐
- 使用Thread类和Runnable接口实现多线程的区别
- OSCP工具之一: dirsearch用法大全
- 数据的存储
- 2022电工杯A题高比例风电电力系统储能运行及配置分析思路
- Implementation steps of docker deploying mysql8
- golang 压缩和解压zip文件
- MySQL的索引
- Mobile measurement and depth link platform - Branch
- Redis configuration and optimization of NoSQL
- Codeworks 5 questions per day (1700 average) - day 7
猜你喜欢
Search of linear table
Antd Comment 递归循环评论
如何检测mysql代码运行是否出现死锁+binlog查看
卡尔曼滤波-1
My brave way to line -- elaborate on what happens when the browser enters the URL
10 ways of interface data security assurance
Gpt-3 is a peer review online when it has been submitted for its own research
List interview common questions
It's too convenient. You can complete the code release and approval by nailing it!
运算放大器应用汇总1
随机推荐
What is the experience of maintaining Wanxing open source vector database
使用Thread类和Runnable接口实现多线程的区别
Adaptive non European advertising retrieval system amcad
23. (ArcGIS API for JS) ArcGIS API for JS ellipse collection (sketchviewmodel)
Mysql-数据丢失,分析binlog日志文件
tflite模型转换和量化
Kotlin Android 环境搭建
【开发软件】 tilipa开发者软件
ABAP dynamic inner table grouping cycle
Force buckle ----- path sum III
Leetcode: interview question 17.24 Maximum cumulative sum of submatrix (to be studied)
Redis源码学习(31),字典学习,dict.c(一)
UltraEdit-32 温馨提示:右协会,取消 bak文件[通俗易懂]
golang 压缩和解压zip文件
Class constant pool and runtime constant pool
Top 50 hit industry in the first half of 2022
链表面试常见题
使用 TiDB Lightning 恢复 GCS 上的备份数据
Create commonly used shortcut icons at the top of the ad interface (menu bar)
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