当前位置:网站首页>MongoDB简介
MongoDB简介
2022-07-03 03:17:00 【Johnny.G】
MongoDB简介
1、MongoDB概述
由C++语言编写,开源而且基于分布式文件存储;在高负载的情况下,通过添加更多节点保证服务器性能;旨在为WEB应用提供可扩展的高性能数据存储解决方案;以文档的形式存储数据,数据结构由键值对(key / value);
其文档类似 JSON 对象,字段值可以包含其他文档、数组以及文档数组。
2、MongoDB特性
• 可扩展、高性能的下一代数据库;
• 易部署、易使用、存储数据方便;
• 面向文档(json格式)存储,易读、高效;
• 模式自由,支持动态查询、完全索引,无模式;
• 高效的数据存储,效率提高;
• 支持复制和故障恢复;
• 以支持云级别的伸缩性,支持水平数据库集群,可动态添加额外服务器;
3、MongoDB的元素
MongoDB由库(database)、集合(collection)、文档对象(documen)三个层次组成,类似于传统关系型数据库由库(database)、表(table)、记录(record)三级层次构成。其中,文档类似于 json 的键值对,例如:{“name”:“tom”,“age”:23},而集合则是一组文档的集合,库则是一组集合的集合。
4、MongoDB支持语言

5、MongoDB的“ObjectId”
不同的机器都能用全局唯一的同种方法方便的生成它。ObjectId使用12字节的存储空间,其生成方式如下:
例:
4e931cb61e19edcd8800017f
时间戳 机器ID PID 计数器
注:
• 时间戳可以保证秒级唯一;
• 机器ID可以保证设计时考虑分布式,避免时钟同步;
• PID可以保证同一台服务器运行多个mongod实例时的唯一性;
• 计数器可以保证同一秒内的唯一性;
6、MongoDB数据类型
| 数据类型 | 举例 |
|---|---|
| 空值 | null |
| 布尔 | ture & false |
| 整数 | 123 |
| 浮点 | 12.3 |
| 字符串 | “hello world” |
| 对象ID | 用 new ObjectId()来申明 |
| 日期 | 用 new Date()来申明时间戳 |
| 数组 | [“apple”,”blanan”,”pear”] |
| 内嵌文档 | {“username” : “jone”, “age”: 13, “contact” : {“home”:”123”,”moblie”:”456”}} |
| RegExp(正则表达式) | /[a-z]/ |
7、MongoDB 与 TRDB 数据库基本概念比较
| MongoDB | TRDB | 比 较 说 明 |
|---|---|---|
| 库 DB | 库 DB | 都有库的概念,需要用命令建立库名。如根据不同项目建立两个库名,一个为 test 库,用于测试,一个为 goodsdb 库, 用于正式业务数据存储及操作 |
| 集合 | 表 | 一个集合对应于一个表。 MongoDB 无须事先定义集合结构, TRDB 必须事先强制定义表结构 |
| 文档 | 行 | 每个文档都有一个特殊的_id,_id值在文档所属集合中是唯一的, 默认由MongoDB 自己维护, 当然也可以由程序员编程指定。 一个“文档”类似 TRDB 的—“行”记录,“文档”要避免不同集合的关联关系( Join ) ,;而以“行”为基础的 TRDB 则强调关联关系 |
| 键值对 | 字段值 | MongoDB“文档”的一个“键值对”类似 TRDB 里的一个“字段值”,不过“文档”里的“键值对”可以嵌入更复杂的数据结构 |
边栏推荐
- Force deduction ----- the minimum path cost in the grid
- Left connection, inner connection
- 程序员新人上午使用 isXxx 形式定义布尔类型,下午就被劝退?
- About HTTP cache control
- Hi3536c v100r001c02spc040 cross compiler installation
- TCP handshake three times and wave four times. Why does TCP need handshake three times and wave four times? TCP connection establishes a failure processing mechanism
- Vs 2019 configuration tensorrt
- Section 26 detailed explanation and demonstration of IPSec virtual private network configuration experiment - simulation experiment based on packettracer8.0
- [shutter] monitor the transparency gradient of the scrolling action control component (remove the blank of the top status bar | frame layout component | transparency component | monitor the scrolling
- 文件重命名
猜你喜欢

Nce detail of softmax approximation

Pytoch configuration

Docker install MySQL

Section 26 detailed explanation and demonstration of IPSec virtual private network configuration experiment - simulation experiment based on packettracer8.0

【PyG】理解MessagePassing过程,GCN demo详解

I2C subsystem (I): I2C spec

Gavin teacher's perception of transformer live class - rasa project's actual banking financial BOT Intelligent Business Dialogue robot architecture, process and phenomenon decryption through rasa inte

Unity3d RPG implementation (medium)
![MySQL practice 45 lecture [transaction isolation]](/img/a5/5420651d6be51e892976f02be8c43c.png)
MySQL practice 45 lecture [transaction isolation]

Limit of one question per day
随机推荐
How to use asp Net MVC identity 2 change password authentication- How To Change Password Validation in ASP. Net MVC Identity 2?
Section 26 detailed explanation and demonstration of IPSec virtual private network configuration experiment - simulation experiment based on packettracer8.0
C programming learning notes [edited by Mr. Tan Haoqiang] (Chapter III sequence programming) 03 operators and expressions
900W+ 数据,从 17s 到 300ms,如何操作
Elsevier latex submitted the article pdftex def Error: File `thumbnails/cas-email. jpeg‘ not found: using draf
How do you adjust the scope of activerecord Association in rails 3- How do you scope ActiveRecord associations in Rails 3?
Pytoch lightweight visualization tool wandb (local)
MySql實戰45講【SQL查詢和更新執行流程】
softmax的近似之NCE详解
Node start server
Nasvit: neural architecture search of efficient visual converter with gradient conflict perception hypernetwork training
Pytoch configuration
Installation and use of memory leak tool VLD
docker安装redis
900w+ data, from 17s to 300ms, how to operate
模糊查詢時報錯Parameter index out of range (1 > number of parameters, which is 0)
New programmers use the isXXX form to define Boolean types in the morning, and are discouraged in the afternoon?
The base value is too large (the error is marked as "08") [duplicate] - value too great for base (error token is'08') [duplicate]
MySql实战45讲【全局锁和表锁】
Use of El tree search method