MongoDB documents

an introduction
A document is a set of key-value pairs (ie BSON). The documents of MongoDB do not need to set the same fields, and the same fields do not need the same data type, which is very different from relational databases, and is also a very prominent feature of MongoDB.
A simple document example is as follows:
{"site":"www.myweb.com", "name":"教程"}
 
The following table lists the terms corresponding to RDBMS and MongoDB
RDBMS MongoDB database service and client
database database
sheet gather
Row Documentation
List field
table union embedded document
primary key Primary key (MongoDB provides key as _id)
Mysqld/Oracle mongod
mysql/sqlplus mongo

 

Three matters needing attention
1. The key/value pairs in the document are ordered.
2. The value in the document can be not only a string inside double quotes, but also several other data types (or even the entire embedded document).
3. MongoDB is type and case sensitive.
4. MongoDB documents cannot have duplicate keys.
5. The key of the document is a string. With few exceptions, keys can use arbitrary UTF-8 characters.
 
Four-document key naming convention
1. The key cannot contain \0 (null character). This character is used to indicate the end of a key.
2. . and $ have special meanings and can only be used under certain circumstances.
3. Keys starting with an underscore "_" are reserved (not strictly required).

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326176942&siteId=291194637