w3resource

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



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/mongodb/shell-methods/database/db-commandHelp.php