From 3742cb07453b50d90aeacec1a0ca2681dfe604e6 Mon Sep 17 00:00:00 2001 From: Allison Moore Date: Thu, 7 May 2015 10:13:13 -0400 Subject: [PATCH] DOCS-5246: adds reference page for setVerboseShell() method --- source/includes/ref-toc-method-native.yaml | 6 ++- source/reference/method/setVerboseShell.txt | 55 +++++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 source/reference/method/setVerboseShell.txt diff --git a/source/includes/ref-toc-method-native.yaml b/source/includes/ref-toc-method-native.yaml index 27b3a1efcae..b2ade1c73cd 100644 --- a/source/includes/ref-toc-method-native.yaml +++ b/source/includes/ref-toc-method-native.yaml @@ -78,7 +78,11 @@ name: ":method:`removeFile()`" file: /reference/method/removeFile description: "Removes the specified file from the local file system." --- +name: ":method:`setVerboseShell()`" +file: /reference/method/setVerboseShell +description: "Configures the :program:`mongo` shell to report operation timing." +--- name: ":method:`_srand()`" file: /reference/method/srand description: "For internal use." -... +... \ No newline at end of file diff --git a/source/reference/method/setVerboseShell.txt b/source/reference/method/setVerboseShell.txt new file mode 100644 index 00000000000..4649f6a2ef8 --- /dev/null +++ b/source/reference/method/setVerboseShell.txt @@ -0,0 +1,55 @@ +================= +setVerboseShell() +================= + +.. default-domain:: mongodb + +.. method:: setVerboseShell() + + The :method:`setVerboseShell()` method configures the :program:`mongo` + shell to print the duration of each operation. + + :method:`setVerboseShell()` has the form: + + .. code-block:: javascript + + setVerboseShell(true) + + :method:`setVerboseShell()` takes one boolean parameter. Specify + ``true`` 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 :program:`mongo` shell, set verbose shell to ``true``: + + .. code-block:: sh + + setVerboseShell(true) + +#. With verbose shell set to ``true``, run :method:`db.collection.aggregate()`: + + .. code-block:: sh + + db.restaurants.aggregate( + [ + { $match: { "borough": "Queens", "cuisine": "Brazilian" } }, + { $group: { "_id": "$address.zipcode" , "count": { $sum: 1 } } } + ] + ); + +#. In addition to returning the results of the operation, the + :program:`mongo` shell now displays information about the duration of + the operation: + + .. code-block:: sh + + { "_id" : "11377", "count" : 1 } + { "_id" : "11368", "count" : 1 } + { "_id" : "11101", "count" : 2 } + { "_id" : "11106", "count" : 3 } + { "_id" : "11103", "count" : 1 } + Fetched 5 record(s) in 0ms