Skip to content

javascript admonition #969

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions source/core/server-side-javascript.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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`
Expand Down
10 changes: 5 additions & 5 deletions source/includes/admonition-javascript-prevalence.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. admonition:: JavaScript in MongoDB
.. admonition::

Although |javascript-using-operation| uses JavaScript, most
interactions with MongoDB use an :doc:`idiomatic drivers
</applications/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
</applications/drivers>` in the language of the interacting
application.
Empty file.
9 changes: 6 additions & 3 deletions source/reference/command/eval.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
5 changes: 4 additions & 1 deletion source/reference/command/group.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions source/reference/command/mapReduce.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ mapReduce
}
)

.. |javascript-using-operation| replace:: :dbcommand:`mapReduce` uses
.. include:: /includes/admonition-javascript-prevalence.rst

.. note::

.. versionchanged:: 2.4
Expand Down
9 changes: 6 additions & 3 deletions source/reference/method.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
.. _js-administrative-methods:

=======================
``mongo`` Shell Methods
=======================
=============
Shell Methods
=============

.. default-domain:: mongodb

.. contents::
:backlinks: none
:local:

.. |javascript-using-operation| replace:: these methods use
.. include:: /includes/admonition-javascript-prevalence.rst

Collection
----------

Expand Down