1. Database Overview
1.1. Introduction
What is a piece?
Answer: Garage
What does the garage use for?
Answer: Parked vehicles, in other words: storage cars.
What is the database used for?
Answer: Store data.
Think 1: The teacher asked you to summarize the number of late arrivals this week, how do you record?
With a small amount of data, use an Excel form to store a list of people who are late.
Thinking 2:2017 Sichuan University entrance exam results how to store?
The amount of data is large, and it is clear that Excel is not satisfied and needs to be stored in the database.
Not only that, many enterprises have their own data needs to be managed, all need to use the database.
1.2. What is a database
The database is a warehouse that organizes, stores, and manages data according to its structure, which is generated more than 60 years ago, with the development of information technology and market, especially after the 1990s, the database technology has been developed more rapidly and applied more widely. It is mainly used to manage the data of various systems as an important technical means for scientific research and decision-making.
What are the common databases:
Is the 2015 database ranking
relational database [What is a relational database?]
relational databases store data in rows and columns for easy user understanding. This series of rows and columns is called a table, and a set of tables makes up a database. The table has a relationship to the data record between the tables.
]:access MYSQL SQL Server Oracle DB2 and so on.
Non-relational database: Mongodb,redis,hbase,couchdb and so on.
In the name of document data, the word "document" is easily misunderstood in two words. In fact, this document is Bson. Bson is a superset of JSON, such as the inability to store binary types in JSON, while Bson expands the type and provides binary support. All the records stored in MongoDB can be represented by Bson. So you can also think of MongoDB as a database of Bson data.
Database is a discipline, specifically to do the database operation of the people called Administrator, referred to as DBA, some DBA refers to a database in-depth research.
Thinking: In this two-day learning process, for our web front-end subject of the students, how can we learn it, how to grasp the degree?
What we ask of you:
? Understand the history of database development. (For interview)
? mongodb and configuration environment variables will be installed.
? Learn the commands commonly used.
Learn to use back-end language for MongoDB crud operations.
1.3.NoSQL Introduction
NoSQL, refers to a non-relational database. NoSQL, sometimes referred to as the abbreviation of not-only SQL, is a generic term for a database management system that differs from a traditional relational database.
NoSQL is used for storage of hyper-scale data. (for example, Google or Facebook collects trillions of bits of data for their users every day). These types of data stores do not require a fixed pattern and can be scaled horizontally without extra action.
1.4.MongoDB Introduction
MongoDB is a distributed-based [physically not together, is separate. For example, a Web page with HTML tags, the page loaded with CSS styles, pictures, and videos, these resources, HTML,JS,CSS may be on Server A, the picture may be on Server B, the video may be on Server C.
] File stores the database. Written by the C + + language. Designed to provide scalable, high-performance data storage solutions for WEB applications.
MongoDB is the most versatile non-relational database, most like relational database.
With the development of big data, non-relational database has become more and more important, the related products have also been developed rapidly. MongoDB is one of the best, as a high-performance open source document database, MongoDB is known for agile, extensible and friendly to enterprise application, because of its simple operation, completely free, open source code, and other characteristics, by the IT practitioners, and is widely deployed in the actual production environment.
Companies using MongoDB include: BAT, 360, Foursquare, Craiglist, Disney, SAP, Intuit, EA, etc.
Many large companies in use, and more and more companies to use, we may be exposed to related projects, although the database is the back-end personnel to do things, but as a high-level front-end, it is necessary to understand it, only better and back-end developers to cooperate, to know the enemy, Baizhanbudai.
1.5.MongoDB Advantages
It is characterized by high performance, easy to deploy, easy to use, and easy to store data. The main features are:
For collection storage, easy to store data for object types.
? Mode freedom.
? support dynamic Queries.
Support full indexes, including internal objects.
? Support queries.
? Support for replication and failure recovery.
? Use efficient binary data storage, including large objects such as video.
Automated fragmentation to support scalability at the cloud level
Support multiple languages such as ruby,python,java,c++,php.
? file storage format is Bson (a JSON extension)
1.6.BSON
Bson is a JSON-like binary form of storage format, called binary JSON, which, like JSON, supports inline document objects and arrays, but Bson has some data types that JSON does not have, such as date and bindata types.
BSON可以做为网络数据交换的一种存储形式,这个有点类似于Google的Protocol Buffer,但是BSON是一种schema-less的存储形式,它的优点是灵活性高,但它的缺点是空间利用率不是很理想。
Bson has three characteristics: light weight, ergodic, high efficiency.
You'll see in the back that we have all the data in the Bson format in the database.
1.7. The difference between a non-relational database and a relational database
Benefits of non-relational databases:
Performance
NoSQL is based on key-value pairs, and can be imagined as the corresponding relationship between the primary key and the value in the table, and does not need to be parsed by the SQL layer, so the performance is very high.
- Scalability
Also because there is no coupling between data based on key-value pairs, it is very easy to scale horizontally.
The benefits of a relational database:
Complex queries
It is easy to use SQL statements to make very complex data queries between multiple tables.
- Transaction support
This makes it possible to implement data access requirements for high security performance.
Summarize:
? The database function is used to store data.
? database is divided into relational database and non-relational database (NoSQL)
A relational database consists of a relationship between a table and a table, and NoSQL is made up of a collection of documents.
? The non-relational database file storage format is Bson (a JSON extension).
Introduction to MongoDB (i)--Database overview