当前位置:网站首页>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 |
边栏推荐
- 敏捷认证(Professional Scrum Master)模拟练习题-2
- Idea format code idea set shortcut key format code
- New programmers use the isXXX form to define Boolean types in the morning, and are discouraged in the afternoon?
- 将时间戳转为指定格式的时间
- Unity3d RPG implementation (medium)
- Model transformation onnx2engine
- 复选框的使用:全选,全不选,选一部分
- Yolov5 project based on QT
- [mathematical logic] normal form (conjunctive normal form | disjunctive normal form | major item | minor item | maximal item | minor item | principal conjunctive normal form | principal disjunctive no
- I2C subsystem (I): I2C spec
猜你喜欢

Pat class B "1104 forever" DFS optimization idea

Pytorch配置

Limit of one question per day

Vs 2019 configuration du moteur de génération de tensorrt

VS 2019配置tensorRT

Idea set method call ignore case

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

Distributed transaction

Vs Code configure virtual environment

umi 路由拦截(简单粗暴)
随机推荐
MySQL practice 45 [global lock and table lock]
Compare float with 0
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
[mathematical logic] predicate logic (individual word | individual domain | predicate | full name quantifier | existence quantifier | predicate formula | exercise)
MySql实战45讲【事务隔离】
MongoDB主配置文件
Vs Code configure virtual environment
Spark on yarn resource optimization ideas notes
Ansible简介【暂未完成(半成品)】
The XML file generated by labelimg is converted to VOC format
复选框的使用:全选,全不选,选一部分
I2C subsystem (I): I2C spec
Section 26 detailed explanation and demonstration of IPSec virtual private network configuration experiment - simulation experiment based on packettracer8.0
MySQL practice 45 lecture [transaction isolation]
模糊查詢時報錯Parameter index out of range (1 > number of parameters, which is 0)
labelme标记的文件转换为yolov5格式
Learning notes of C programming [compiled by Mr. Tan Haoqiang] (Chapter III sequence programming) 04 C sentence
用Three.js做一個簡單的3D場景
Idea format code idea set shortcut key format code
Agile certification (professional scrum Master) simulation exercise-2