Document
The document is the basic data structure in MongoDB, such as: {"name": "Jack", "LastName": "XI"} key-value pairs are ordered , and {"LastName": "XI", "name": "Jack"} is different.
Each document has a special key _id, which is unique . The key to the document is a string, and the value can be a number, a string, an array, and other types. Keys can use UTF-8 characters in most cases. Key cannot
usethe-\, which represents the end of the key . The $ symbol also has a special effect. The document is case -sensitive, {"name": "Jack"} and {"Name": "Jack"} is not a. The document cannot have duplicate keys.
Collection
A collection is a set of documents and is modeless. The collection name cannot be an empty string, cannot be a, cannot start with system. Collection with. Split Sub-collection, Person.head,person.hand
Database
Multiple collections make up a database, and one MongoDB instance can have multiple databases.
Naming criteria: cannot be an empty string, cannot contain spaces, $,\,/,\0, should all lowercase, up to 64 bytes
Start MongoDB
In the absence of parameters, the default presence of/data/db uses port 27017
MongoDB Shell
The shell is a complete JavaScript interpreter that can run JavaScript programs. Can write more lines, not finished can be written on the next line
When the shell is opened, the test database is connected and copied to the DB global variable
Introduction to MongoDB (i)