V. MongoDB Interactive Shell

Source: Internet
Author: User

Introduction

The MongoDB release package containsBin/MongoIt is the MongoDB Interactive Shell environment. This tool is a javascript shell that allows you to initiate commands from the command line to MongoDB. (Basically, it is an extension of the spidermonkey shell ).

The shell is used:

  • View database content
  • Test Query
  • Create an index
  • Other management functions

In this Wiki, if you see some JavaScript-like code, you can consider it as a shell example. View the charts in the driver syntax table to convert these examples into other languages.

More information
  • Shell Overview
  • Shell reference
  • Shell API documentation
Shell data type number

By default, shell considers the number to be a floating point. You can use a shell-embedded longnumber () class to use 64-bit integers. If you want [bson] data of an integer or long integer, you may see the following:

 "bytes" : { "floatApprox" : 575175 } 

Or, in version 1.6 +, the larger number is displayed as follows:

 {..., "bytes" : NumberLong(5284376243087482000) ,...} 

Note that long numbers in versions earlier than 1.6 are displayed as follows:

 "bytes" : { "floatApprox" : 5284376243087482000, "top" : 1230364721, "bottom" : 4240317554 } 

In addition, setting or increasing any number with JavaScript will change the data type to a floating point number.

Time

The date () method returns a string,NewDate () "returns an object (you use it to store data ).

> Date () sun May 02 2010 19:07:40 GMT-0700 (Pacific Daylight Time)> new date () "Sun May 02 2010 19:07:43 GMT-0700 (Pacific Daylight Time) "> typeof (new date () Object> typeof (date () string // The following content is printed:> new date () isodate (" 2010-11-29t19: 41: 46.730z ")
Binary data

[Bson] The bindata data type is displayed in shell through the bindata class. RunHelp
MiscView more 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.