当前位置:网站首页>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 |
边栏推荐
- C programming learning notes [edited by Mr. Tan Haoqiang] (Chapter III sequence programming) 03 operators and expressions
- Use of El tree search method
- labelme标记的文件转换为yolov5格式
- VS 2019安装及配置opencv
- Spark on yarn resource optimization ideas notes
- 文件重命名
- MongoDB简介
- node 开启服务器
- Parameter index out of range (1 > number of parameters, which is 0)
- Edit and preview in the back pipe to get the value writing method of the form
猜你喜欢

Pytorch轻量级可视化工具wandb(local)

VS code配置虚拟环境
![C programming learning notes [edited by Mr. Tan Haoqiang] (Chapter III sequence programming) 03 operators and expressions](/img/4a/1df03d9f3315debb4c335260ed39f2.jpg)
C programming learning notes [edited by Mr. Tan Haoqiang] (Chapter III sequence programming) 03 operators and expressions

Elsevier latex submitted the article pdftex def Error: File `thumbnails/cas-email. jpeg‘ not found: using draf

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
![MySQL practice 45 [SQL query and update execution process]](/img/cd/3a635f0c3bb4ac3c8241cb77285cc8.png)
MySQL practice 45 [SQL query and update execution process]

Pat class B "1104 forever" DFS optimization idea

Limit of one question per day

Docker install redis

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
随机推荐
二维数组中的元素求其存储地址
The file marked by labelme is converted to yolov5 format
@Accessors annotation function specifies that the prefix follows the hump naming
[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
Stepping on pits and solutions when using inputfilter to limit EditText
使用InputFilter限制EditText时踩坑及解决方案
Section 26 detailed explanation and demonstration of IPSec virtual private network configuration experiment - simulation experiment based on packettracer8.0
The XML file generated by labelimg is converted to VOC format
Vs Code configure virtual environment
Docker install MySQL
idea 加载不了应用市场解决办法(亲测)
Don't use the new Dede collection without the updated Dede plug-in
labelimg生成的xml文件转换为voc格式
MongoDB基本操作【增、删、改、查】
[error record] the parameter 'can't have a value of' null 'because of its type, but the im
ComponentScan和ComponentScans的区别
Use three JS make a simple 3D scene
labelme标记的文件转换为yolov5格式
基于QT的tensorRT加速的yolov5
File rename