Introduction to MongoDB (i)

Source: Internet
Author: User

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)

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.