MongoDB documents, collections, and databases

Source: Internet
Author: User
Tags mongodb

To understand the terms of MongoDB, you can compare it to a relational database:

One, document document is a set of key-value pairs. Documents are the basic unit of data in MongoDB, very similar to those in a relational database.
Yes. Multiple keys and their associated values are placed together in an orderly manner as documents.

{"Name": "Swingwang", "gender": "Male"}
The key-value pairs in the document are ordered, and the order in which the two key-value pairs are reversed becomes another document. For key-value pairs in a document, the key is a string type and can be used with any UTF-8 character. The value can be any data type, including the document. MongoDB is case sensitive and type.

two, set [collection]

Collections in MongoDB are a set of documents. Equivalent to a table in a relational database.

The collection is modeless. means that the documents in the collection can be of a variety. "In a relational database, each row has a key with the same name and has a key value corresponding to the same type."
The following document can exist within a collection:

{"Name": "Swingwang"}
{"Gender": "Male"}

third, the database
In MongoDB, multiple collections form a database. Databases are independent, and even on disk, different databases are placed in different files.

Some of the reserved databases
-admin "Root User Library"
-Local
-Config "save shard Information"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.