当前位置:网站首页> MongoDB数据库基础知识整理
MongoDB数据库基础知识整理
2022-07-07 13:11:00 【1024问】
了解Mongodb之前先了解一下NoSQL,NoSQL是Not Only SQL的缩写。由提供缺乏SQL关系数据库的严格限制模型的存储和检索技术组成。主要是简化设计、水平扩展以及对数据的可用性进行更精细的控制。NoSQL有多种技术例如:Redis的键值结构、HBase的列结构等。
二、MongodbMongodb也是NoSQL的一种。它基于的文档模型把数据对象作为一个集合中单独的文档来存储。用它来提供高性能、高可用性和自动扩展的数据存储。
三、集合Mongodb通过使用集合将数据分组在一起。集合仅仅是一组具有相同或类似用途的文档。集合类似于传统SQL数据库的表。只是集合不执行严格的模式,同一集合中的文档可以具有彼此略微不同的结构。
四、文档文档是Mongodb数据库中单个数据实体的表示。SQL的行数据是平坦的,行中的每个值都有一个列。在Mongodb中文档可以包含嵌入子文档,从而为应用程序提供更密切的内在数据模型。在Mongodb中代表文档的记录被存储为BSON,这是JSON的一个轻量级的二进制形式。它的字段/值对应于Javascript的属性和值。同时在MongoDB中文档的最大大小是16MB。这可以防止RAM使用过量或对文件系统产生剧烈冲击。
此外,文档的字段名不能包含(null)字符、句点(.)或美元符号($)._id字段名是为对象的ID保留的。该_id字段是系统中的一个唯一的ID,它由以下几个部分组成:
1.一个4字节的值,代表从纪元以来过去的秒数。
2.一个3字节的机器标识符
3.一个2字节的进程ID
4.一个3字节的计数器,从一个随机值开始
五、Mongodb数据类型Mongodb为每一种数据类型分配了从1到255的整数ID号,可使用它来按类型查询。
| Double | 双精度数值 | 1 |
| String | 字符串 | 2 |
| Object | 对象 | 3 |
| Array | 数组 | 4 |
| Binary data | 二进制数据 | 5 |
| Object id | 对象ID | 7 |
| Boolean | 布尔值 | 8 |
| Date | 日期 | 9 |
| Null | 空值 | 10 |
| Regular Expression | 正则表达式 | 11 |
| JavaScript | Javascript | 13 |
| Symbol | 符号 | 14 |
| JavaScript(with scope) | Javascript(带作用域) | 15 |
| 32-bit intger | 32位整数 | 16 |
| Timestamp | 时间戳 | 17 |
| 64-bit integer | 64位整数 | 18 |
| Min Key | 最小值 | 255 |
| Max Key | 最大值 | 127 |
当比较不同的BSON类型的值时,Nongodb使用下面的比较顺序从最低到最高:
1.最小键(内部类型)
2.空值
3.数值
4.符号、字符串
5.对象
6.数组
7.二进制数据
8.对象ID
9.布尔值
10.日期,时间戳
11.正则表达式
12.最大键(内部类型)
到此这篇关于MongoDB数据库基础的文章就介绍到这了。希望对大家的学习有所帮助,也希望大家多多支持软件开发网。
边栏推荐
- Infinite innovation in cloud "vision" | the 2022 Alibaba cloud live summit was officially launched
- JSON解析实例(Qt含源码)
- MySQL installation configuration 2021 in Windows Environment
- 【深度学习】图像超分实验:SRCNN/FSRCNN
- Five pain points for big companies to open source
- [server data recovery] a case of RAID data recovery of a brand StorageWorks server
- [server data recovery] a case of RAID data recovery of a brand StorageWorks server
- Promoted to P8 successfully in the first half of the year, and bought a villa!
- Ctfshow, information collection: web6
- #yyds干货盘点# 解决名企真题:交叉线
猜你喜欢

Five pain points for big companies to open source

How to enable radius two factor / two factor (2fa) identity authentication for Anheng fortress machine

简述keepalived工作原理

CTFshow,信息搜集:web5

13 ux/ui/ue best creative inspiration websites in 2022
![[server data recovery] a case of RAID data recovery of a brand StorageWorks server](/img/8c/77f0cbea54730de36ce7b625308d2f.png)
[server data recovery] a case of RAID data recovery of a brand StorageWorks server

防火墙基础之服务器区的防护策略

IDA pro逆向工具寻找socket server的IP和port

Promoted to P8 successfully in the first half of the year, and bought a villa!

Niuke real problem programming - day15
随机推荐
Ascend 910 realizes tensorflow1.15 to realize the Minist handwritten digit recognition of lenet network
MySQL bit类型解析
Ctfshow, information collection: web5
【服务器数据恢复】某品牌StorageWorks服务器raid数据恢复案例
[server data recovery] a case of RAID data recovery of a brand StorageWorks server
FFmpeg----图片处理
TypeScript 发布 4.8 beta 版本
Niuke real problem programming - Day12
What are PV and UV? pv、uv
Five pain points for big companies to open source
word中删除一整页
什么是pv和uv? pv、uv
What is data leakage
Stream learning notes
In the field of software engineering, we have been doing scientific research for ten years!
Summer safety is very important! Emergency safety education enters kindergarten
@Introduction and three usages of controlleradvice
Ctfshow, information collection: web2
15、文本编辑工具VIM使用
暑期安全很重要!应急安全教育走进幼儿园