setVerboseShell()

  • setVerboseShell()
  • The setVerboseShell() method configures the mongoshell to print the duration of each operation.

setVerboseShell() has the form:

  1. setVerboseShell(true)

setVerboseShell() takes one boolean parameter. Specifytrue or leave the parameter blank to activate the verbose shell.Specify false to deactivate.

Example

The following example demonstrates the behavior of the verbose shell:

  • From the mongo shell, set verbose shell to true:
  1. setVerboseShell(true)
  1. db.restaurants.aggregate(
  2. [
  3. { $match: { "borough": "Queens", "cuisine": "Brazilian" } },
  4. { $group: { "_id": "$address.zipcode" , "count": { $sum: 1 } } }
  5. ]
  6. );
  • In addition to returning the results of the operation, themongo shell now displays information about the duration ofthe operation:
  1. { "_id" : "11377", "count" : 1 }
  2. { "_id" : "11368", "count" : 1 }
  3. { "_id" : "11101", "count" : 2 }
  4. { "_id" : "11106", "count" : 3 }
  5. { "_id" : "11103", "count" : 1 }
  6. Fetched 5 record(s) in 0ms