The basic concept of MongoDB
1. Documentation
1.1 Definition: Documentation is the core concept of MongoDB. Multiple keys and their associated values are placed in an orderly manner
Together is the document. A document can be understood as the total row of data for a relational database.
1.2 means: {"greeting": "Hello,world"}
1.3 Precautions:
Document contains multiple key/value pairs
The key/value pairs in the document are ordered
A value in a document can not only make a string, but can also be a different data type
The key in the document is a string. The key cannot contain a. The $ special Character _ is also reserved
2. Collection
2.1 Definition: A collection is a set of documents. Can understand a table that is equivalent to a relational database
2.2 Sub-collection: Use "." The characters separate the sub-collection.
3. Database
Multiple documents make up a collection, and multiple collections form a database.
4. Start MongoDB
5.mongodb Shell
5.1 Run MONGO start shell
5.2 MongoDB Client
The real power of the shell is that it is a standalone mongedb client. When it's open,
The shell connects to the MONGODB server's test database and assigns the database connection
To the global variable db. This variable is the main entry point for accessing MongoDB through the shell.
Use database name
DB Print Database name
Db. Collection name return collection
Since you can access the collection in the shell, you can basically perform all of the database
Have done.
The basic concept of MongoDB Learning notes (ii)