Access the mongo Shell Help

On this page本页内容

Note

The following document pertains to the mongo shell included in the MongoDB Server Download. For information on the new MongoDB Shell, mongosh, refer to the mongosh Documentation.

To understand the differences between the two shells, see Comparison of the mongo Shell and mongosh.

In addition to the documentation in the MongoDB Manual, the mongo shell provides some additional information in its “online” help system. This document provides an overview of accessing this help information.

Command Line Help

To see the list of options and help for starting the mongo shell, use 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:

[1]If the deployment runs with access control, the operation returns different values based on user privileges. See listDatabases Behavior for details.

Collection Help

In the mongo shell:

Cursor Help

When you perform read operations with the find() method in the mongo shell, you can use various cursor methods to modify the find() behavior and various JavaScript methods to handle the cursor returned from the find() method.

Some useful methods for handling cursors are:

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

See also参阅

mongo Shell Methods