w3resource
MongoDB Tutorial

MongoDB: db.commandHelp() method

db.commandHelp

The db.commandHelp() method is used to return help information for a database command.

Syntax:

db.commandHelp(command)

Parameters:

Name Description Required /
Optional
Type
command The name of a database command. Required string

Example: MongoDB: db.commandHelp() method

The following command will display the help text of command findAndModify.

db.commandHelp('findAndModify');

Output:

> db.commandHelp('findAndModify');
help for: findAndModify { findAndModify: "collection", query: {processed:false}, update: {$set: {processed:true}}, new: true}
{ findAndModify: "collection", query: {processed:false}, remove: true, sort: {priority:-1}}
Either update or remove is required, all other fields have default values.
Output is in the "value" field

Retrieve the restaurants data from here

Previous: cursor.toArray() method
Next: db.copyDatabase() methos