The concept comparison between MongoDB and relational database:
MongoDB relational database
document row
collection table
instance n Database
1. Documentation
Document: Multiple keys and their associated values are placed together in an orderly manner. JS, the document is represented as an object.
{"Key": "Value"}
{"Name": "Zhangsan", "Age": 20}
2. Collection
Collection: A set of documents is a collection. Collections are modeless (different types of documents can be in a collection). To enhance flexibility and ease of management, you need to create a pattern to bring together documents of the relevant type.
Specification for collection naming: non-null, not "system." Beginning Non-$
3. Database
Namespace (fully qualified name): Database name. Collection name. Subset Name
4. Start, use 27017 port
ubuntu:$./mogod
Windows:mogod.exe
5. Run the shell
$./mongo
6.shell command
Select Database
>use Foo
Create
>db.user.insert ({"Name": "Zhangsan", "Age": 20})
Read
>db.user.find ()
Update
>db.user.update ({"Name": "Zhangsan"},{"gender": "Male"})
Delete
>db.user.remove ({"Name": "Zhangsan"})
Data type ('-' means not supported in shell)
Null Boolean; 64 floating point; string;
Symbol-; object ID; A date; a regular expression;
JS code; Binary data-; maximum/small value-;
Not defined; an array; an inline document.