MongoDB Basic Knowledge----MongoDB authoritative guide to read

Source: Internet
Author: User

A document is a basic unit of data in MongoDB, a row in a type-relational database, and each document has a key _id that is unique to thekey value. collections can be seen as tables that have dynamic schemas.

MongoDB An instance can have multiple databases that are independent of each other.

Mongodb distinguishes between types , case- sensitive , content in a document cannot have duplicate keys , and key-value pairs in a document are ordered .

Collection Name:

The collection name cannot be an empty string and cannot contain the \ s character , which indicates that the collection name ends.

The collection name cannot have system . Start , which is the prefix reserved by the systems collection.

The collection name cannot contain reserved characters .

Database name:

Cannot be an empty string, basically only use letters and numbers in ASSCII. The library name is case sensitive . The library name is up to 64 bytes.

Admin---Root database

Local---This database can never be copied.

Config---Shard information is stored in the config database.

  before adding the database name to the collection name, you get the fully qualified name of the collection, which is the namespace. Example: Cms.blog.posts.

Sub-Collections:

The conventions used in the Organization collection . Splits a subset of different namespaces . Example: Blog.posts blog.authors

The collection of blogs here has nothing to do with its subset.

Port:

Default listener: 27017 Port .

HTTP Server default listener: 28017 port.

MongoDB Basic Data type:

Null Boolean numeric string date regular expression array inline document object ID binary data JS code .

  the date is saved as a number of milliseconds .

When you create a Date object, you should use the new date () instead of the date direct function call.

      The direct call as the date () function returns a string form of a date, not a Date object.

Mongodb can go deep into the structure of the document and manipulate its contents inside the array structure. and build the index.

The default Objectid:

Objectid can be of any type, and the default is an object .

Use 12-byte storage: Built with timestamp machine counters.

Putting the work of the new ID on the client side can alleviate the database burden better.

Mongodb Shell:

Db.help () View the database level Help, Db.foo.help () view Help at the collection level.

To execute a JS file using the shell:

MONGO **.js

Or: Load (' **.js ')

The. mongorc.js file is a mongodb default load file.

You can set the editor variable:

Example: editor= "/usr/bin/emacs"

var wap = ....

Edit WAP

This allows you to edit the WAP variable using emacs.

To access some special collections:

Db.getcollection (' version ');

MongoDB Basic Knowledge----MongoDB authoritative guide to read

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.