================================= JavaScript Changes in MongoDB 3.2 ================================= .. default-domain:: mongodb .. contents:: On this page :local: :backlinks: none :depth: 1 :class: singlecol In MongoDB 3.2, the javascript engine used for both the :binary:`~bin.mongo` shell and for server-side javascript in :binary:`~bin.mongod` changed from V8 to `SpiderMonkey `_. To confirm which JavaScript engine you are using, you can use either :js:func:`interpreterVersion()` method in the :binary:`~bin.mongo` shell and the :data:`~buildInfo.javascriptEngine` field in the output of :method:`db.serverBuildInfo()` In MongoDB 3.2, this will appear as ``MozJS-38`` and ``mozjs``, respectively. Modernized JavaScript Implementation (ES6) ------------------------------------------ SpiderMonkey brings with it increased support for features defined in the 6th edition of `ECMAScript `_, abbreviated as ES6. ES6 adds many new language features, including: - `arrow functions `_, - `destructuring assignment `_, - `for-of loops `_, and - `generators `_. Changes to the ``mongo`` Shell ------------------------------ MongoDB 3.2 will return JavaScript and BSON :bsontype:`undefined ` values intact if saved into a collection. Previously, the :binary:`~bin.mongo` shell would convert ``undefined`` values into ``null``. MongoDB 3.2 also adds the :parameter:`disableJavaScriptJIT` parameter to :binary:`~bin.mongod`, which allows you to disable the JavaScript engine's JIT acceleration. The :binary:`~bin.mongo` shell has a corresponding :option:`--disableJavaScriptJIT ` flag. Removed Non-Standard V8 Features -------------------------------- SpiderMonkey does **not** allow the non-standard ``Error.captureStackTrace()`` function that prior versions of MongoDB supported. If you must record stack traces, you can capture the ``Error().stack`` property as a workaround.