On this page
The 5th edition of ECMAscript , abbreviated as ES5, adds many new language features, including:
The following features do not work as expected on documents returned from MongoDB queries:
Object.seal()throws an exception on documents returned from MongoDB queries.
Object.freeze()throws an exception on documents returned from MongoDB queries.
Object.preventExtensions()incorrectly allows the addition of new properties on documents returned from MongoDB queries.
enumerableproperties, when added to documents returned from MongoDB queries, are not saved during write operations.
For objects that have not been returned from MongoDB queries, the features work as expected.
You need to use alternative XML processing if you used any of the following constructors/methods:
V8 does not support the non-standard destructuring assignments. Destructuring assignment “extract[s] data from arrays or objects using a syntax that mirrors the construction of array and object literals.” - Mozilla docs
The following destructuring assignment is invalid with V8 and throws a
V8 does not support Iterator(), StopIteration(), and generators .
V8 does not support the use of for each…in construct. Use
for (var x in y) construct instead.
for each (var x in y) construct is invalid with V8:
Instead, in version 2.4, you can use the
for (var x in y) construct:
You can also use the array instance method
forEach() with the ES5 method
V8 does not support Array comprehensions .
Use other methods such as the
Array instance methods
With V8, the following array comprehension is invalid:
Instead, you can implement using the
Array instance method
forEach() and the ES5 method
The new logic uses the
Array instance method
forEach() and not the generic method
Array.forEach(); V8 does not support
Array generic methods. See Array Generic Methods for more information.
V8 does not support multiple
catch blocks and will throw a
The following multiple catch blocks is invalid with V8 and will throw
"SyntaxError: Unexpected token if":
V8 will produce different outcomes than SpiderMonkey with conditional function definitions .
The following conditional function definition produces different outcomes in SpiderMonkey versus V8:
With SpiderMonkey, the conditional function outputs
undefined, whereas with V8, the conditional function outputs
If your code defines functions this way, it is highly recommended that you refactor the code. The following example refactors the conditional function definition to work in both SpiderMonkey and V8.