diff --git a/source/core/server-side-javascript.txt b/source/core/server-side-javascript.txt index 8ac9d14cd4e..469de0c057a 100644 --- a/source/core/server-side-javascript.txt +++ b/source/core/server-side-javascript.txt @@ -16,8 +16,8 @@ Server-side JavaScript Overview -------- -MongoDB supports server-side execution of JavaScript code within the -database process: +MongoDB supports the execution of JavaScript code for the following +server-side operations: - :dbcommand:`mapReduce` and the corresponding :program:`mongo` shell method :method:`db.collection.mapReduce()`. See @@ -30,6 +30,9 @@ database process: - :ref:`running-js-scripts-in-mongo-on-mongod-host` +.. |javascript-using-operation| replace:: the above operations use +.. include:: /includes/admonition-javascript-prevalence.rst + .. seealso:: :doc:`/tutorial/store-javascript-function-on-server` diff --git a/source/includes/admonition-javascript-prevalence.rst b/source/includes/admonition-javascript-prevalence.rst index 1247356aff0..11e9ef06456 100644 --- a/source/includes/admonition-javascript-prevalence.rst +++ b/source/includes/admonition-javascript-prevalence.rst @@ -1,6 +1,6 @@ -.. admonition:: JavaScript in MongoDB +.. admonition:: - Although |javascript-using-operation| uses JavaScript, most - interactions with MongoDB use an :doc:`idiomatic drivers - ` to interact with MongoDB using the same - language as the application itself. + Although |javascript-using-operation| JavaScript, most interactions + with MongoDB do not use JavaScript but use an :doc:`idiomatic driver + ` in the language of the interacting + application. diff --git a/source/includes/fact-javascript-prevalence.rst b/source/includes/fact-javascript-prevalence.rst new file mode 100644 index 00000000000..e69de29bb2d diff --git a/source/reference/command/eval.txt b/source/reference/command/eval.txt index afd0a19d1cd..edd6d0a4910 100644 --- a/source/reference/command/eval.txt +++ b/source/reference/command/eval.txt @@ -39,7 +39,10 @@ eval .. include:: /includes/parameters-eval.rst :start-after: eval-param-nolock - Consider the following example which uses :dbcommand:`eval` to + .. |javascript-using-operation| replace:: :dbcommand:`eval` uses + .. include:: /includes/admonition-javascript-prevalence.rst + + The following example uses :dbcommand:`eval` to perform an increment and calculate the average on the server: .. include:: /includes/examples-eval.rst @@ -60,8 +63,8 @@ eval JavaScript interpreter evaluates functions entered directly into the shell. - If an error occurs, :dbcommand:`eval` throws an exception. Consider - the following invalid function that uses the variable ``x`` without + If an error occurs, :dbcommand:`eval` throws an exception. + The following invalid function uses the variable ``x`` without declaring it as an argument: .. code-block:: javascript diff --git a/source/reference/command/group.txt b/source/reference/command/group.txt index bdc457f2189..3d20bc7e13b 100644 --- a/source/reference/command/group.txt +++ b/source/reference/command/group.txt @@ -101,7 +101,10 @@ group the ``reduce`` field whereas the :dbcommand:`group` command takes the ``$keyf`` field and the ``$reduce`` field. - Consider the following examples of the :method:`db.collection.group()` method: + .. |javascript-using-operation| replace:: :dbcommand:`group` uses + .. include:: /includes/admonition-javascript-prevalence.rst + + The following are examples of the :method:`db.collection.group()` method: The examples assume an ``orders`` collection with documents of the following prototype: diff --git a/source/reference/command/mapReduce.txt b/source/reference/command/mapReduce.txt index 662a6b77913..c3584a87d7d 100644 --- a/source/reference/command/mapReduce.txt +++ b/source/reference/command/mapReduce.txt @@ -55,6 +55,9 @@ mapReduce } ) + .. |javascript-using-operation| replace:: :dbcommand:`mapReduce` uses + .. include:: /includes/admonition-javascript-prevalence.rst + .. note:: .. versionchanged:: 2.4 diff --git a/source/reference/method.txt b/source/reference/method.txt index d84b3a84172..2bd24f6130f 100644 --- a/source/reference/method.txt +++ b/source/reference/method.txt @@ -1,8 +1,8 @@ .. _js-administrative-methods: -======================= -``mongo`` Shell Methods -======================= +============= +Shell Methods +============= .. default-domain:: mongodb @@ -10,6 +10,9 @@ :backlinks: none :local: +.. |javascript-using-operation| replace:: these methods use +.. include:: /includes/admonition-javascript-prevalence.rst + Collection ----------