- Reference >
- Legacy
mongoShell > - Native Methods in the Legacy Shell >
- setVerboseShell()
setVerboseShell()¶
On this page
Note
The native method listed here is for the legacy mongo shell.
To use native methods in mongosh, see
Native Methods in mongosh.
-
setVerboseShell()¶ The
setVerboseShell()method configuresmongoshto print the duration of each operation.setVerboseShell()has the form:setVerboseShell()takes one boolean parameter. Specifytrueor leave the parameter blank to activate the verbose shell. Specifyfalseto deactivate.
Example¶
The following example demonstrates the behavior of the verbose shell:
From
mongosh, set verbose shell totrue:With verbose shell set to
true, rundb.collection.aggregate():In addition to returning the results of the operation,
mongoshnow displays information about the duration of the operation: