MongoDB journey (iii) basic management (MongoDBJavascriptShell)

Source: Internet
Author: User
MongoDB journey (iii) basic management (MongoDBJavascriptShell) Postedon: showdbs; showcollections; db. stats (); db. members. stats (); db. runCommand ({dbstats: 1}); db. runCommand ({collstats: 1}); db. runCommanddb. $ cmd. fin

MongoDB journey (iii) basic management (MongoDB Javascript Shell) Posted on: show dbs; show collections; db. stats (); db. members. stats (); db. runCommand ({dbstats: 1}); db. runCommand ({collstats: 1}); db. runCommand = db. $ cmd. fin

MongoDB journey (iii) basic management (MongoDB Javascript Shell) Posted on

You can obtain database information in the following ways:

Show dbs; show collections;

Db. stats (); db. members. stats (); db. runCommand ({dbstats: 1}); db. runCommand ({collstats: 1 });

Db. runCommand = db. $ cmd. findOne

Db. help ();

In addition, shell also has a built-in Tab incomplete mechanism;

Db. numbers. save; // view the internal implementation of the save method.

Others:

Object ID generation:

Each set must be unique for all documents, and the primary key is stored in the _ id field of the document. It consists of 12 bytes of specific structure. Id = 4-byte timestamp (Unix timestamp) + 3-byte machine ID + 2-byte process ID + 3-byte counter. For example: 4c291865 238d3b 19b2 000001. Most drivers are allowed to provide this timestamp, providing the creation time, Hong Kong server, Hong Kong Space, accurate to the nearest one second.

BSON:

It is both the storage format and Command Format of MongoDB. All documents are stored on the disk in BSON format, and all queries and commands are specified by BSON documents. Therefore, on the U.S. server, all MongoDB drivers must be converted between language-specific document descriptions and BSON.

The BSON specification contains 19 types.

The core functions of the database driver are as follows: Create an ID, serialize BSON, and communicate with the database server.

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.