MongoDB Learning Note 2 basic knowledge of MongoDB

Source: Internet
Author: User

1.MongoDB data is basically called a document, similar to a row in a relational database;

2. Similarly, a set (Collection) is a table of dynamic mode (schame);

An instance of 3.MongoDB can have multiple databases that are independent of each other, and no database contains multiple collections;

4. Each document has a key, which is unique in the set where the key is located;

5.MongoDB comes with a JavaScript Shell to manage MongoDB instances and data operations;

I. Documents and Keys

The document data is expressed like a hash or dictionary, for example:

{"geeting": "Hello world!", "foo": 3}

Or

{"geeting": "Hello world!" }

{"Foo": 3}

Geeting and Foo are keys, "Hello World" and 3 are values;

MongoDB differentiates size, type, and order, for example

{"Foo": 3}

{"FOO": 3}

{"Foo": "3"}

{"Foo": 3}

{"geeting": "Hello world!", "foo": 3}

{"Foo": 3, "geeting": "Hello world!" }

This is a document that is different;

The keys in the collection cannot be duplicated, for example

{"foo": "Hello world!", "foo": 3}

This document is illegal;

Two. Dynamic mode (Schame)

A collection is a dynamic pattern, meaning that a document in a collection can be of various kinds, such as

{"geeting": "Hello world!" }

{"Foo": 3}

Of course, you can also put documents of the same type into the same collection, easily create indexes and speed up searches, but not enforce them;

Three. Collection

A collection can have subcollections, separated by dot numbers, for example

The collection blog has subsets of posts and subsets of authors, which are expressed as

Blog.posts

Blog.authors

Four. MongoDB Database

A MongoDB database is composed of multiple collections, each of which is a separate file; MongoDB has a reserved database name, such as

Admin, this is the authentication database, add the user to the Admin database, this user will automatically get all the database permissions, in addition, some special commands can only be run from the admin database, such as listing the database and shutting down the server;

Locally, all local collections can be stored in this database.

The CONFIG,MONGODB database is used for the Shard setting, and the Shard information is stored in the Config database;


This article is from the "Margin with Wish" blog, please be sure to keep this source http://281816327.blog.51cto.com/907015/1598275

MongoDB Learning Note 2 basic knowledge of MongoDB

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.