Skip to content

Commit 1d6cef8

Browse files
committed
eval authentication and fix lock warning
1 parent e092ff0 commit 1d6cef8

File tree

4 files changed

+21
-8
lines changed

4 files changed

+21
-8
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
With :setting:`authentication <auth>` enabled, |object| will fail
2+
during the operation if you do not have the permission to perform a
3+
specified task.
4+
5+
.. .. versionchanged:: 2.4 You must have full admin access to run.

source/includes/fact-eval-lock.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
By default, |object| takes a global write lock before evaluating the
22
JavaScript function. As a result, |object| blocks all other read and
3-
write operations to the database while the |object| operation
4-
runs. Set ``nolock`` to ``true`` to prevent |object| from taking the
5-
global write lock before evaluating the JavaScript. ``nolock`` does
6-
not impact whether operations within the JavaScript code itself takes
7-
a write lock.
3+
write operations to the database while the |object| operation runs. Set
4+
``nolock`` to ``true`` on the |nolockobject| to prevent the
5+
|nolockobject| from taking the global write lock before evaluating the
6+
JavaScript. ``nolock`` does not impact whether operations within the
7+
JavaScript code itself takes a write lock.

source/reference/command/eval.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ eval
5757
:field boolean nolock: Optional.
5858

5959
.. |object| replace:: :dbcommand:`eval`
60+
.. |nolockobject| replace:: :dbcommand:`eval` command
6061
.. include:: /includes/fact-eval-lock.rst
6162

6263
Consider the following example which uses :dbcommand:`eval` to
@@ -136,12 +137,13 @@ eval
136137
.. warning::
137138

138139
.. \|object| defined above ..
140+
.. \|nolockobject| defined above ..
139141

140142
- .. include:: /includes/fact-eval-lock.rst
141143

142-
- :dbcommand:`eval` also takes a JavaScript lock.
144+
- :dbcommand:`eval` also takes a JavaScript lock.
143145

144-
.. modified in 2.4 version, the JavaScript lock is up to and including version 2.2
146+
.. modified in 2.4 version, the JavaScript lock is up to and including version 2.2
145147

146148
- Do not use :dbcommand:`eval` for long running operations as
147149
:dbcommand:`eval` blocks all other operations. Consider using
@@ -154,4 +156,6 @@ eval
154156
is possible to use :dbcommand:`eval` with non-sharded
155157
collections and databases stored in a :term:`sharded cluster`.
156158

159+
- .. include:: /includes/fact-eval-authentication.rst
160+
157161
.. seealso:: :doc:`/applications/server-side-javascript`

source/reference/method/db.eval.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,13 @@ db.eval()
9595

9696
.. |object| replace:: :method:`db.eval()`
9797

98+
.. |nolockobject| replace:: :dbcommand:`eval` *command*
99+
98100
- .. include:: /includes/fact-eval-lock.rst
99101

100102
- :method:`db.eval()` also takes a JavaScript lock.
101103

102-
.. modified in 2.4 version, the JavaScript lock is up to and including version 2.2
104+
.. modified in 2.4 version, the JavaScript lock is up to and including version 2.2
103105

104106
- Do not use :method:`db.eval()` for long running operations, as
105107
:method:`db.eval()` blocks all other operations. Consider using
@@ -112,6 +114,8 @@ db.eval()
112114
it is possible to use :method:`db.eval()` with non-sharded
113115
collections and databases stored in :term:`sharded cluster`.
114116

117+
- .. include:: /includes/fact-eval-authentication.rst
118+
115119
.. seealso::
116120

117121
:doc:`/applications/server-side-javascript`

0 commit comments

Comments
 (0)