Skip to content

Commit 2e743e2

Browse files
(DOCSP-21673): Upgrade MozJS (#1153)
* (DOCSP-21673): Upgrade MozJS * updates per review * add behavior to accumulator * wording * address review comment
1 parent 2fe20fc commit 2e743e2

File tree

7 files changed

+125
-19
lines changed

7 files changed

+125
-19
lines changed

source/core/server-side-javascript.txt

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
:orphan:
22

3+
.. _server-side-javascript:
4+
35
======================
46
Server-side JavaScript
57
======================
@@ -12,8 +14,6 @@ Server-side JavaScript
1214
:depth: 1
1315
:class: singlecol
1416

15-
.. _server-side-javascript:
16-
1717
Overview
1818
--------
1919

@@ -52,17 +52,26 @@ for performing batch administrative work. When you run
5252
:binary:`~bin.mongosh` on the server, connecting via the localhost
5353
interface, the connection is fast with low latency.
5454

55+
.. _disable-server-side-js:
56+
57+
Disable Server-Side Execution of JavaScript
58+
-------------------------------------------
59+
60+
.. include:: /includes/fact-disable-javascript-with-noscript.rst
61+
62+
Behavior
63+
--------
64+
5565
Concurrency
56-
-----------
66+
~~~~~~~~~~~
5767

5868
Refer to the individual method or operator documentation for any
5969
concurrency information. See also the :ref:`concurrency table
6070
<faq-concurrency-operations-locks>`.
6171

62-
.. _disable-server-side-js:
72+
Unsupported Array and String Functions
73+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6374

64-
Disable Server-Side Execution of JavaScript
65-
-------------------------------------------
66-
67-
.. include:: /includes/fact-disable-javascript-with-noscript.rst
75+
.. include:: /includes/fact-6.0-js-engine-change.rst
6876

77+
.. include:: /includes/fact-mozjs-list-lead-in.rst
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
MongoDB 6.0 upgrades the internal JavaScript engine used for
2+
:ref:`server-side JavaScript <server-side-javascript>`,
3+
:group:`$accumulator`, :expression:`$function`, and :query:`$where`
4+
expressions and from MozJS-60 to MozJS-91. Several non-standard array
5+
and string functions that existed in MozJS-60 are removed in MozJS-91.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
For the complete list of removed array and string functions, see the
2+
:ref:`6.0 compatibility notes <6.0-js-engine-change>`.

source/reference/operator/aggregation/accumulator.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,13 @@ scripting:
288288

289289
See also :ref:`security-checklist-javascript`.
290290

291+
Unsupported Array and String Functions
292+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
293+
294+
.. include:: /includes/fact-6.0-js-engine-change.rst
295+
296+
.. include:: /includes/fact-mozjs-list-lead-in.rst
297+
291298
Examples
292299
--------
293300

source/reference/operator/aggregation/function.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,12 @@ Given the available aggregation operators:
155155
- However, if you must create custom expressions,
156156
:expression:`$function` is preferred over :query:`$where`.
157157

158+
Unsupported Array and String Functions
159+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
160+
161+
.. include:: /includes/fact-6.0-js-engine-change.rst
162+
163+
.. include:: /includes/fact-mozjs-list-lead-in.rst
158164

159165
Examples
160166
--------
@@ -275,4 +281,3 @@ The example can be expressed using :query:`$expr` and :expression:`$function`:
275281
args: [ "$name" ],
276282
lang: "js"
277283
} } } )
278-

source/reference/operator/query/where.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,13 @@ scripting:
125125

126126
See also :ref:`security-checklist-javascript`.
127127

128+
Unsupported Array and String Functions
129+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
130+
131+
.. include:: /includes/fact-6.0-js-engine-change.rst
132+
133+
.. include:: /includes/fact-mozjs-list-lead-in.rst
134+
128135
Example
129136
-------
130137

source/release-notes/6.0-compatibility.txt

Lines changed: 81 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,20 @@ Community Edition
8383

8484
- :abbr:`RHEL (Red Hat Enterprise Linux)`-72-s390x
8585

86+
Regular Expressions
87+
-------------------
88+
89+
``$regex`` Find Queries No Longer Ignore Invalid Regex
90+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
91+
92+
.. include:: /includes/fact-5.1-regex-find-functionality.rst
93+
94+
``$regex`` Schema Validation Error Behavior
95+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
96+
97+
.. include:: /includes/fact-5.1-regex-document-schema-validation.rst
98+
99+
86100
Removed Operators
87101
-----------------
88102

@@ -220,16 +234,6 @@ Deprecations
220234

221235
- The :dbcommand:`reIndex` command is deprecated in MongoDB v6.0.
222236

223-
``$regex`` Find Queries No Longer Ignore Invalid Regex
224-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
225-
226-
.. include:: /includes/fact-5.1-regex-find-functionality.rst
227-
228-
``$regex`` Schema Validation Error Behavior
229-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
230-
231-
.. include:: /includes/fact-5.1-regex-document-schema-validation.rst
232-
233237
``$mod`` Error Behavior
234238
~~~~~~~~~~~~~~~~~~~~~~~
235239

@@ -300,6 +304,73 @@ will receive an error message like the following:
300304
:: caused by :: network error while attempting to run command
301305
'isMaster' on host '127.0.0.1:27017'
302306

307+
.. _6.0-js-engine-change:
308+
309+
Removed Array and String Functions for Server-Side JavaScript
310+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
311+
312+
.. include:: /includes/fact-6.0-js-engine-change.rst
313+
314+
Removed Array Functions
315+
```````````````````````
316+
317+
Starting in MongoDB 6.0, the following array functions are removed and
318+
cannot be used in server-side JavaScript with ``$accumulator``,
319+
``$function``, and ``$where`` expressions:
320+
321+
- ``Array.concat``
322+
- ``Array.every``
323+
- ``Array.filter``
324+
- ``Array.forEach``
325+
- ``Array.indexOf``
326+
- ``Array.join``
327+
- ``Array.lastIndexOf``
328+
- ``Array.map``
329+
- ``Array.pop``
330+
- ``Array.push``
331+
- ``Array.reduce``
332+
- ``Array.reduceRight``
333+
- ``Array.reverse``
334+
- ``Array.shift``
335+
- ``Array.slice``
336+
- ``Array.some``
337+
- ``Array.sort``
338+
- ``Array.splice``
339+
- ``Array.unshift``
340+
341+
Removed String Functions
342+
````````````````````````
343+
344+
Starting in MongoDB 6.0, the following array functions are removed and
345+
cannot be used in server-side JavaScript with ``$accumulator``,
346+
``$function``, and ``$where`` expressions:
347+
348+
- ``String.charAt``
349+
- ``String.charCodeAt``
350+
- ``String.concat``
351+
- ``String.contains``
352+
- ``String.endsWith``
353+
- ``String.includes``
354+
- ``String.indexOf``
355+
- ``String.lastIndexOf``
356+
- ``String.localeCompare``
357+
- ``String.match``
358+
- ``String.normalize``
359+
- ``String.replace``
360+
- ``String.search``
361+
- ``String.slice``
362+
- ``String.split``
363+
- ``String.startsWith``
364+
- ``String.substr``
365+
- ``String.substring``
366+
- ``String.toLocaleLowerCase``
367+
- ``String.toLocaleUpperCase``
368+
- ``String.toLowerCase``
369+
- ``String.toUpperCase``
370+
- ``String.trim``
371+
- ``String.trimLeft``
372+
- ``String.trimRight``
373+
303374
Default ``db.stats()`` Settings
304375
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
305376

0 commit comments

Comments
 (0)