In addition to the documentation in the MongoDB Manual, the MONGO Shell provides some additional information in I TS "Online" Help system. This document provides a overview of accessing this Help information.
Command line Help
The list of options and help for starting the MONGO shell with the --help option from the command Line
MONGO--help
Shell Help
To see the list of help, in the MONGO shell, type help:
Help
Database Help
In the MONGO Shell:
Collection Help
In the MONGO Shell:
Cursor Help
When you perform read Operations with the find () method in the &NBSP;mongo shell , you can use various cursor methods to modify THE&NBSP;find () behavior and various JavaScript methods to handle the cursor returned from the < TT class= "XRef mongodb mongodb-method docutils literal" >find () method.
- To list the available modifier and cursor handling methods with the Db.collection.find (). Help () command:
Db.collection.find (). Help ()
<collection> Can is the name of a collection that exists, although specify a collection that doesn ' T exist.
- To see the implementation of the cursor method, type the db.<collection>.find () .<method> name without The parenthesis (()), as in the following example which would return the implementation of the ToArray () Method
Db.collection.find (). ToArray
Some useful methods for handling cursors is:
- Hasnext () which checks whether the cursor has a more documents to return.
- next () which returns the next document and advances the cursor position forward by one.
- ForEach (<function>) which iterates the whole cursor and applies the <function> to each docum ENT returned by the cursor. The <function> expects a single argument which corresponds to the document from each iteration.
For examples on iterating a cursor and retrieving the "documents from the" cursor, see cursor handling. See also cursor for all available cursor methods.
Wrapper Object Help
To get a list of the wrapper classes available in the MONGO shell, such as Bindata (), type help misc in the MONGO Shell:
Help Misc
Mongodb-the MONGO Shell, Access the MONGO shell help