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 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.