当前位置:网站首页>01 overview, application scenarios, Download methods, connection methods and development history of mongodb
01 overview, application scenarios, Download methods, connection methods and development history of mongodb
2022-06-28 04:05:00 【cui_ yonghua】
Catalog : The basic chapter ( Can solve the problem of 80 The problem of )
01 MongoDB Overview 、 Application scenarios 、 Download mode 、 Connection mode and development history, etc
02 MongoDB data type 、 Key concepts and shell Commonly used instructions
03 MongoDB Various additions to documents 、 to update 、 Delete operation summary
04 MongoDB Various query operations And summary of aggregation operations
05 MongoDB Summarize the various operations of the column
python3 operation MongoDB Various cases of
One . mongo summary
1.1 Reference learning website
Official website address :https://www.mongodb.com/
Official documents :https://docs.mongodb.com/manual/
Novice tutorial : https://www.runoob.com/mongodb/mongodb-tutorial.html
w3cschool: https://www.w3cschool.cn/mongodb/
Book stack net : https://www.bookstack.cn/books/piaosanlang-mongodb
1.2 MongoDB Introduction to
MongoDB It's a scalable 、 Open source 、 Table structure freedom 、 use C++ Language and document oriented high-performance distributed database . by WEB Applications provide scalable, high-performance data storage solutions .
MongoDB Is a product between relational and non-relational databases , Non-relational databases are the most versatile , Most like a relational database .
MongoDB Store data as a document , Data structures are defined by key values (key=>value) The composition of .MongoDB The document is similar to JSON object . Field values can contain other documents , Arrays and document arrays .
attach :MongoDB Baidu Encyclopedia
1.3 MongoDB What is suitable for
mongo It is suitable for storing a large amount of data with weak correlation ; Mass production , High concurrency , Irregular ;
mongo Storage structure : library 、 aggregate 、 file 、 Field , and mysql: library 、 surface 、 That's ok 、 Columns are very similar .
but mongo No need to define table structure in advance , The fields of data can be changed at will , Concurrent writes are also much faster than relational databases .
1.4 MongoDB The main features
- For collection storage : Easy to store json Type and object type data , It's easy to operate ;
- Support query and dynamic query : MongoDB Support rich query operations ,MongoDB Almost support SQL Most of the queries in . Query instruction usage JSON The mark of form , Can easily query the embedded objects and arrays in the document ;
- Multilingual support : Such as python, java, c++, php, C# etc. .
- With powerful computing framework :: Relational databases provide group by Equal component aggregation function , and mongo Provides a more powerful MapReduce programme , meanwhile MongoDB It also provides Spark The connector , For the statistics of massive data , Analysis provides convenience .Mongodb Medium Map/reduce It is mainly used for batch processing and aggregation of data .Map Function call emit(key,value) Traverses all records in the collection , take key And value Pass to Reduce Function to process .
- Replication sets ensure high availability of data : MongoDB Support replication set (replset), Replica sets support backup 、 Features such as automatic failover .MongoDB Support master-slave replication mechanism , Data backup can be realized 、 Fault recovery 、 Read expansion and other functions . The replication mechanism based on replica set provides the function of automatic failure recovery , Ensures that cluster data is not lost .
- Multi document transaction support : 4.0 Replication set deployment mode is supported in version , This feature is available in 4.2 The version is more perfect , And start to support the shard cluster deployment mode . This key feature promotes mongo High concurrency of relational database , Be able to support ACID Application scenarios with high requirements , So as to replace the relational database ;
- Sharding cluster achieves high scalability : MongoDB Support automatic sharding sharding, The function of sharding is to realize the distributed storage of massive data , Sharding is usually used in conjunction with replica sets , Read and write separation , Load balancing .
- Model freedom : Table structure can be expanded , aggregate ( surface ) Chinese document ( A line of records ) Field of ( Owned columns ) It can change .
- Support full indexing : You can index on any attribute , Contains internal objects .MongoDB Index and RDBMS The index is basically the same , You can specify the properties 、 Create indexes on internal objects to speed up queries . besides ,MongoDB It also provides the ability to create geospatial based indexes .
- Support aggregation :;MongoDB Provide powerful aggregation tools , Such as count、group etc. , Support use MapReduce Complete complex aggregation tasks .
- Use efficient binary data storage : Include large objects ( Video frequency ). Store in binary format , You can save any type of data object .
- It can be accessed through the network : It can be accessed remotely through the network MongoDB database .
- GridFS function : GridFS yes MongoDB A built-in feature in , Can be used to store a large number of small files .
1.5 MongoDB Main application scenarios :
1. Real-time website data processing : It's great for real-time insertion 、 Update and query , And has the website real-time data storage needs of replication and highly scalable .
2. cache : Because of the high performance , It is suitable as a caching layer for information infrastructure . After system restart , The persistence cache layer built by it prevents the underlying data source from being overloaded .
3. A highly scalable scenario : It is very suitable for a database composed of dozens or hundreds of servers , Its roadmap already contains the right MapReduce Built in engine support .
4. Big size 、 Low value data : Using traditional relational database to store some data may be more expensive , Before that , Most of the time, programmers tend to choose traditional files for storage .
5. For objects and JSON Data storage : Mongo Of BSON The data format is very suitable for the storage and query of document format .
Not applicable scenarios are as follows :
1) Highly transactional systems are required : for example , Banking or accounting systems . The traditional relational database is still more suitable for applications that need a large number of atomic complex transactions .
2) Traditional business intelligence applications : Specific to a specific problem BI Database will produce highly optimized query mode . For such applications , Data warehouse may be a more appropriate choice .
3) Complex cross-document ( surface ) Cascade query .
1.6 MongoDB The application case
Here are some companies MongoDB Practical application of :
Craiglist Upper use MongoDB Archive billions of records .
FourSquare, Location based social networking sites , stay Amazon EC2 On the server MongoDB Share data .
Shutterfly, Internet based social and personal publishing services , Use MongoDB Various persistent data storage requirements .
bit.ly, One is based on Web URL shortening service , Use MongoDB Store your own data .
spike.com, One MTV Network associates , spike.com Use MongoDB Of .
Intuit company , A software and service provider for small businesses and individuals , For small businesses MongoDB Tracking user data .
sourceforge.net, Resource site lookup , Create and distribute open source software for free , Use MongoDB Back end storage .
etsy.com , A website for buying and selling handmade items , Use MongoDB.
The New York times , One of the leading online news portals , Use MongoDB.
CERN, The famous Institute of particle physics , CERN LHC data use MongoDB.
1.7 Common programming language operations MongoDB Case study
python operation monog: python3 operation MongoDB Case study
java operation mongo: java operation MongoDB Case study
php operation mongo: php operation MongoDB Case study
nodejs operation mongo: nodejs operation MongoDB Case study
Two . mongo Download and driver support for
Can be in mongodb Download the installation package from the official website ,mongo Download address of each platform : https://www.mongodb.com/try/download
1、Windows Installation can refer to : Windows Platform installation MongoDB
2、linux Installation can refer to : Linux Platform installation MongoDB
3、mac Installation can refer to : Mac OSX Platform installation MongoDB
MongoDB There are official drivers as follows :
C、C++、C# 、.NET、Erlang、Haskell、Java、JavaScript、Lisp、node.JS、Perl、PHP、Python、Ruby、Scala、Go wait .
3、 ... and . MongoDB Tools and connections
3.1 Monitoring tools :
MongoDB Provides network and system monitoring tools Munin, It is used as a plug-in for MongoDB in .
Gangila yes MongoDB High performance system monitoring tools , It is used as a plug-in for MongoDB in .
Open source tools based on GUI Cacti, For viewing CPU load , Network bandwidth utilization , It also provides an application for monitoring MongoDB Plug in for .
3.2 Visual interface :
Fang of Mongo – Webpage , from Django and jQuery What constitutes a .
Futon4Mongo – One CouchDB Futon web Of mongodb Copycat version .
Mongo3 – Ruby It's written in .
MongoHub – Apply to OSX Applications for .
Opricot – A browser based MongoDB Console , from PHP Written by .
Database Master — Windows Of mongodb Management tools
RockMongo — first-class PHP Linguistic MongoDB Management tools , Lightweight , Support multiple languages .
3.3 standard URI Connection syntax :
mongodb://[username:[email protected]]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
If the user name and password are used to connect : mongodb://admin:[email protected]/test
Connect to in safe mode replica set, And wait for at least two replication servers to write successfully , Timeout set to 2 second : mongodb://host1,host2,host3/?safe=true;w=2;wtimeoutMS=2000
Parameter description ::mongodb:// This is a fixed format , Must specify .
username:[email protected] optional , If you set , After connecting to the database server , Drivers will try to log in to this database
host1 At least one... Must be specified host, host1 This is it URI The only one to fill in . It specifies the address to connect to the server . If you want to connect a replica set , Please specify more than one host address .
portX Optional specified port , If you don't fill in , The default is 27017
/database If specified username:[email protected], Connect and verify login to the specified database . If not specified , The default test database .
?options It's the connection option . If not used /database, Then we need to add /. All connection options are key value pairs name=value, Pass between key value pairs & or ;( A semicolon ) separate
Description of connection options :1. replicaSet=name: verification replica set The name of , Such as :Impliesconnect=replicaSet.
2. slaveOk=true|false:
true: stay connect=direct In mode , The drive will connect the first machine , Even if this server is not the master . stay connect=replicaSet In mode , The driver will send all the write requests to the master and distribute the read operations to other slave servers .
false: stay connect=direct In mode , The driver will automatically find the main server . stay connect=replicaSet In mode , The driver only connects to the primary server , And all the read and write commands are connected to the main server .
3. safe=true|false:
true: After the update operation , Drivers will send getLastError Command to ensure the update is successful .( Also refer to wtimeoutMS).
false: After every update , The driver will not send getLastError To ensure that the update is successful .
4. w=n: Drive add { w : n } To getLastError command . be applied to safe=true.
5. wtimeoutMS=ms: Drive add { wtimeout : ms } To getlasterror command . be applied to safe=true.
6. fsync=true|false:
true: Drive add { fsync : true } To getlasterror command . be applied to safe=true.
false: Drivers will not be added to getLastError In command .
7. journal=true|false: If set to true, Synchronize to journal ( Write to entity before committing to database ). be applied to safe=true
8. connectTimeoutMS=ms: Can open connection time .
9. socketTimeoutMS=ms: Send and receive sockets Time for .
Four . mongo The history of development
2007 year ,Mongodb By a man in New York called 10gen Organizational development of , Now is be called MongoDB
2009 year , After nearly 2 Year development ,10gen Has developed MongoDB And open source it and officially named it mongoDB, At the same time, establish an open source community , Through community operations MongoDB.
2009 year 2 month Released MongoDB 1.0 , Provides most of the basic query functions .
2009 year 12 month Released MongoDB 1.2 Introduced map-reduce, Support large-scale data processing . See MongoDB After the great potential of ,10gen The company quickly expanded its team .
2010 year 3 month Released MongoDB 1.4, Background index creation is introduced . It is said that this is mongoDB The first real product
2010 year 8 month Released MongoDB 1.6 ) Introduces some of the main features , For example, the slice used for horizontal expansion and contraction 、 A replica set with automatic fail over capability and the ability to IPv6 Support for . here we are 2012 year ,10gen Yes 100 Employees , The company started offering 24/7 service .
2012 year 5 month 23 Japan , Released MongoDB2.1 . This version uses a new architecture , There are many enhancements .
2012 year 6 month 6 Japan , Released MongoDB2.0.6 , Distributed document database .
2012 year 8 month ,MongoDB 2.2 edition Release , The introduction of polymerization pipeline , Multiple data processing steps can be combined into an operation chain .
2013 year MongoDB Launch the first commercial version MongoDB Enterprise Advanced
2013 year 4 month 23 Japan , MongoDB 2.4.3 Release , This release includes some performance optimizations , Function addition and bug Repair
2013 year 8 month 20 Japan ,MongoDB 2.4.6 Release , It's still performance optimized , Enhancements and bug Mainly repair
2015 year 3 month MongoDB 3.0 Release , Contains new ,WiredTiger Storage engine 、 Pluggable storage engine API, Added 50 Replica set restrictions and security improvements , Later in the same year 3.2 edition , Support document validation 、 Partial indexes and some major aggregations are added .
2016 year MongoDB Launched Atlas service ,MongoDB Atlas With public cloud service providers ( Google 、 Microsoft Azure) cooperation , This year ,MongoDB There was a very serious security gate incident , Hackers pass MongoDB The default listening address for 0.0.0.0 Delete data , And blackmail through this vulnerability , payment 0.2 To 0.5 And bitcoin can recover data .
2017 year 10 month MongDB Establishment of the company 10 Anniversary , pass with flying colors IPO stay NYSE listing , The opening quotation 24 dollar , Valuation of the company 16 Billion dollars , And get 1.92 Billion dollars in financing .
2017 year 11 month Release MongoDB 3.6 , Join queries for multiple sets 、 Change flow and use JSON Schema provides better support for document validation .
2018 year 6 month Release MongoDB 4.0, This release has received widespread attention , Provides cross document transaction processing capabilities . This is an important milestone ,MongoDB Ready for high data integrity requirements .
2019 year 3 month 18 Japan , Forrester grant MongoDB NoSQL The title of leader
2019 year 10 month MongoDB 4.2 Release , Start supporting distributed transactions .
2020 year 10 month , MongoDB The community version of is 4.4.1, Scalability and performance enhancements , Reduce replication latency , Increased availability and fault tolerance , Enhanced query capability and ease of use ,MongoDB Cloud platform function update .MongoDB Gradually from a vendor focused on database services , Become a provider of data platform services .
By 2021 year 7 month MongoDB Release the latest 5.0 edition , It supports the time series data platform 、 Online re segmentation 、 Versioning API Other new characteristics , In application scenario coverage 、 Data management efficiency 、 Application compatibility has been greatly enhanced .
current MongoDB, By 2020 year ,MongoDB The number of downloads worldwide has reached 1.1 100 million times .MongoDB The company has 2000 More than employees , There are more than 18000 Paid customers , Many of them use it at the same time MongoDB Atlas and MongoDB Enterprise Edition . By 2020 year 8 month ,MongoDB The community version is 4.4. Most big companies use the community version in some of their internal scenarios .MongoDB The Community Edition is still open source , In addition to some key features , It is associated with MongoDB The enterprise version is almost .
️ If it works , Thank you for clicking three times !!!️
边栏推荐
- One article tells you what kubernetes is
- 美创数据安全管理平台获信通院“数据安全产品能力验证计划”评测证书
- Understanding and learning of parental delegation mechanism
- Web APIs DOM event foundation dark horse programmer
- 05 MongoDB对列的各种操作总结
- MySQL master-slave replication, separation and resolution
- 关于 SY8120I 的DC-DC的降压芯片的学习(12V降至3.3V)
- 如何系统学习一门编程语言? | 黑马程序员
- 多线程与高并发三:AQS底层源码分析及其实现类
- 利用ELK 搭建日志分析系统(二)—— 部署安装
猜你喜欢

Web APIs DOM-事件基础丨黑马程序员

A solution to the inefficiency of setting debug mode in developing flask framework with pychar

Principle and Simulation of switching power supply buck circuit

PyCharm设置仿sublime配色方案

局域网内共享打印机的几种方式

数字有为,易步到位 华为携“5极”明星产品加速布局商业市场

谈云原生,不得不谈的容器

【毕业季】研究生の毕业总结

黑體輻射初探

Meichuang was selected into the list of "2022 CCIA top 50 Chinese network security competitiveness"
随机推荐
一千行 MySQL 学习笔记,值得收藏!
Leetcode: monotonic stack structure (Advanced)
MySQL 主从复制、分离解析
领歌leangoo敏捷看板工具新增导出卡片文档和粘贴共享脑图节点功能
Unity C # e-learning (11) -- custom protocol generation tool
品达通用权限系统(Day 5~Day 6)
Particle theory of light (photoelectric effect / Compton effect)
Chapter 1 Introduction to bash
Building log analysis system with elk (III) -- Security Authentication
使用tensorboard进行loss可视化
Pycharm不同项目之间共用第三方模块
机器人编程教育的市场竞争力
Understanding and learning of parental delegation mechanism
How to apply for ASTM E108 flame retardant test for photovoltaic panels?
vscode中出现无法在只读编辑器中编辑
How to modify a se38 editor theme
applicationContext. Getbeansoftype obtains the execution methods of all implementation classes under an interface or obtains the operation application scenarios such as implementation class objects. L
从遇见大咖到成为大咖,昇腾AI开发者创享日给开发者带来无限可能
AS 3744.1标准中提及ISO8191测试,两者测试一样吗?
局域网内共享打印机的几种方式