当前位置:网站首页>Introduction to mongodb
Introduction to mongodb
2022-07-03 03:23:00 【Johnny. G】
MongoDB brief introduction
1、MongoDB summary
from C++ Language writing , Open source and based on distributed file storage ; Under high load , Ensure server performance by adding more nodes ; For the purpose of WEB Applications provide scalable, high-performance data storage solutions ; Store data as a document , Data structure consists of key value pairs (key / value);
Its documents are similar JSON object , Field values can contain other documents 、 Arrays and document arrays .
2、MongoDB characteristic
• Scalable 、 High performance next generation database ;
• Easy to deploy 、 Easy to use 、 It's convenient to store data ;
• Document oriented (json Format ) Storage , Easy to read 、 Efficient ;
• Model freedom , Support dynamic query 、 Full index , Modeless ;
• Efficient data storage , Increased efficiency ;
• Support for replication and recovery ;
• To support cloud level scalability , Support horizontal database clustering , Additional servers can be added dynamically ;
3、MongoDB The elements of
MongoDB By Library (database)、 aggregate (collection)、 Document object (documen) Three levels make up , Similar to the traditional relational database, the database (database)、 surface (table)、 Record (record) Three levels of composition . among , The document is similar to json The key/value pair , for example :{“name”:“tom”,“age”:23}, A collection is a collection of documents , A library is a collection of sets .
4、MongoDB Support language
5、MongoDB Of “ObjectId”
Different machines can easily generate it with the same method that is globally unique .ObjectId Use 12 Byte storage space , The generation method is as follows :
example :
4e931cb61e19edcd8800017f
Time stamp machine ID PID Counter
notes :
• Timestamp can guarantee the uniqueness of seconds ;
• machine ID It can ensure that the distributed design is considered , Avoid clock synchronization ;
• PID It can ensure that the same server runs multiple mongod Uniqueness when instance ;
• The counter can guarantee the uniqueness in the same second ;
6、MongoDB data type
data type | give an example |
---|---|
Null value | null |
Boolean | ture & false |
Integers | 123 |
floating-point | 12.3 |
character string | “hello world” |
object ID | use new ObjectId() To claim |
date | use new Date() To declare the timestamp |
Array | [“apple”,”blanan”,”pear”] |
Embedded documents | {“username” : “jone”, “age”: 13, “contact” : {“home”:”123”,”moblie”:”456”}} |
RegExp( Regular expressions ) | /[a-z]/ |
7、MongoDB And TRDB Comparison of basic concepts of database
MongoDB | TRDB | Than a say bright |
---|---|---|
library DB | library DB | Have the concept of Library , You need to use the command to create the library name . For example, two database names are established according to different projects , One for test library , Used for testing , One for goodsdb library , Used for formal business data storage and operation |
aggregate | surface | A set corresponds to a table . MongoDB There is no need to define the set structure in advance , TRDB The table structure must be forcibly defined in advance |
file | That's ok | Every document has a special _id,_id The value is unique in the collection to which the document belongs , Default by MongoDB Self maintenance , Of course, it can also be specified by the programmer . One “ file ” similar TRDB Of —“ That's ok ” Record ,“ file ” Avoid the relationship between different sets ( Join ) ,; And then “ That's ok ” On the basis of TRDB Emphasize the relationship |
Key value pair | field value | MongoDB“ file ” One of the “ Key value pair ” similar TRDB One of them “ field value ”, however “ file ” Inside “ Key value pair ” More complex data structures can be embedded |
边栏推荐
- Summary of determinant knowledge points in Chapter 1 of Linear Algebra (Jeff's self perception)
- LVGL使用心得
- 【PyG】理解MessagePassing过程,GCN demo详解
- Docker install redis
- MySql實戰45講【SQL查詢和更新執行流程】
- VS 2019 配置tensorRT生成engine
- Hi3536C V100R001C02SPC040 交叉编译器安装
- 从输入URL到页面展示这中间发生了什么?
- 900W+ 数据,从 17s 到 300ms,如何操作
- 【AI实战】应用xgboost.XGBRegressor搭建空气质量预测模型(一)
猜你喜欢
el-tree搜索方法使用
Nce detail of softmax approximation
MySQL practice 45 lecture [row lock]
Hi3536c v100r001c02spc040 cross compiler installation
docker安装mysql
Spark on yarn资源优化思路笔记
渤、黄海的潮汐特征
Agile certification (professional scrum Master) simulation exercise-2
I2C subsystem (I): I2C spec
Positioning (relative positioning, absolute positioning, fixed positioning, Z-index) 2022-2-11
随机推荐
softmax的近似之NCE详解
用Three.js做一個簡單的3D場景
About HTTP cache control
MongoDB复制集【主从复制】
labelme标记的文件转换为yolov5格式
docker安装mysql
Learning notes of C programming [compiled by Mr. Tan Haoqiang] (Chapter III sequence programming) 04 C sentence
VS克隆时显示403错误
I2C subsystem (I): I2C spec
文件重命名
【PyG】理解MessagePassing过程,GCN demo详解
Find the storage address of the elements in the two-dimensional array
Unity3d RPG implementation (medium)
基于QT的tensorRT加速的yolov5
Limit of one question per day
LVGL使用心得
[combinatorics] Application of exponential generating function (multiple set arrangement problem | different balls in different boxes | derivation of exponential generating function of odd / even sequ
Pytoch lightweight visualization tool wandb (local)
Réglez la hauteur et lancez le système. Currenttimemillis catton
node 开启服务器