@@ -644,23 +644,23 @@ The primary impacts of the switch to V8 are:
644
644
645
645
- concurrency improvements,
646
646
- modernized JavaScript implementation, and
647
- - removal of non-standard Spidermonkey features.
647
+ - removal of non-standard SpiderMonkey features.
648
648
649
- Concurrency Improvements
650
- ````````````````````````
649
+ Improved Concurrency
650
+ ````````````````````
651
651
652
652
Previously, MongoDB operations that required the JavaScript interpreter
653
653
had to acquire a lock, and a single :program:`mongod` could only run a
654
654
single JavaScript operation at a time. The switch to V8 improves
655
- concurrency by allowing each JavaScript operation to run on a separate
656
- core .
655
+ concurrency by permiting multiple JavaScript operations to run at the
656
+ same time .
657
657
658
658
Modernized JavaScript Implementation (ES5)
659
659
``````````````````````````````````````````
660
660
661
661
The 5th edition of `ECMAscript
662
662
<http://www.ecma-international.org/publications/standards/Ecma-262.htm>`_,
663
- abbreviated as ES5, adds many new language features, such as :
663
+ abbreviated as ES5, adds many new language features, including :
664
664
665
665
- standardized `JSON
666
666
<http://www.ecma-international.org/ecma-262/5.1/#sec-15.12.1>`_,
@@ -672,9 +672,9 @@ abbreviated as ES5, adds many new language features, such as:
672
672
<http://www.ecma-international.org/ecma-262/5.1/#sec-15.3.4.5>`_,
673
673
674
674
- `array extensions
675
- <http://www.ecma-international.org/ecma-262/5.1/#sec-15.4.4.16>`_,
675
+ <http://www.ecma-international.org/ecma-262/5.1/#sec-15.4.4.16>`_, and
676
676
677
- - getters/setters and much more .
677
+ - getters and setters .
678
678
679
679
With V8, MongoDB supports the latest standardized version of JavaScript
680
680
with the following exceptions. The following features do not work as expected
@@ -688,12 +688,13 @@ on documents returned from MongoDB queries:
688
688
689
689
- enumerable properties.
690
690
691
- Removal of Non-standard Spidermonkey Features
692
- `````````````````````````````````````````````
691
+ Removed Non-standard SpiderMonkey Features
692
+ ``````````````````````````````````````````
693
693
694
- V8 does **not** support the following *non-standard* `Spidermonkey
694
+ V8 does **not** support the following *non-standard* `SpiderMonkey
695
695
<https://developer.mozilla.org/en-US/docs/SpiderMonkey>`_ JavaScript
696
- extensions.
696
+ extensions, previously supported by MongoDB's use of SpiderMonkey as
697
+ its JavaScript engine.
697
698
698
699
E4X Extensions
699
700
^^^^^^^^^^^^^^
@@ -754,7 +755,7 @@ V8 does not support ``InternalError()``. Use ``Error()`` instead.
754
755
^^^^^^^^^^^^^^^^^^^^^^^^^^^
755
756
756
757
V8 does not support the use of `for each...in
757
- <https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Statements/for_each...in>`_
758
+ <https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Statements/for_each...in>`_
758
759
construct. Use ``for (var x in y)`` construct
759
760
instead.
760
761
@@ -793,16 +794,16 @@ instead.
793
794
print(value);
794
795
});
795
796
796
- Array comprehensions
797
- ^^^^^^^^^^^^^^^^^^^^
797
+ Array Comprehension
798
+ ^^^^^^^^^^^^^^^^^^^
798
799
799
800
V8 does not support `Array comprehensions
800
801
<https://developer.mozilla.org/en-US/docs/JavaScript/Guide/Predefined_Core_Objects#Array_comprehensions>`_.
801
802
802
803
Use other methods such as the ``Array`` instance methods ``map()``,
803
804
``filter()``, or ``forEach()``.
804
805
805
- .. example::
806
+ .. example::
806
807
807
808
With V8, the following array comprehension is **invalid**:
808
809
@@ -840,7 +841,7 @@ Multiple Catch Blocks
840
841
V8 does not support multiple ``catch`` blocks and will throw a
841
842
``SyntaxError``.
842
843
843
- .. example::
844
+ .. example::
844
845
845
846
The following multiple catch blocks is **invalid** with V8 and will
846
847
throw ``"SyntaxError: Unexpected token if"``:
@@ -855,17 +856,17 @@ V8 does not support multiple ``catch`` blocks and will throw a
855
856
print('standard error')
856
857
}
857
858
858
- Conditional Function Definitions
859
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
859
+ Conditional Function Definition
860
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
860
861
861
- V8 will produce different outcomes than Spidermonkey with `conditional
862
+ V8 will produce different outcomes than SpiderMonkey with `conditional
862
863
function definitions
863
864
<https://developer.mozilla.org/en-US/docs/JavaScript/Guide/Functions>`_.
864
865
865
866
.. example::
866
867
867
868
The following conditional function definition produces different
868
- outcomes in Spidermonkey versus V8:
869
+ outcomes in SpiderMonkey versus V8:
869
870
870
871
.. code-block:: javascript
871
872
@@ -876,12 +877,12 @@ function definitions
876
877
print(typeof go)
877
878
}
878
879
879
- With Spidermonkey , the conditional function outputs ``undefined``,
880
+ With SpiderMonkey , the conditional function outputs ``undefined``,
880
881
whereas with V8, the conditional function outputs ``function``.
881
882
882
883
If your code defines functions this way, it is highly recommended
883
884
that you refactor the code. The following example refactors the
884
- conditional function definition to work in both Spidermonkey and V8.
885
+ conditional function definition to work in both SpiderMonkey and V8.
885
886
886
887
.. code-block:: javascript
887
888
@@ -893,7 +894,7 @@ function definitions
893
894
print(typeof go)
894
895
}
895
896
896
- The refactored code outputs ``undefined`` in both Spidermonkey and V8.
897
+ The refactored code outputs ``undefined`` in both SpiderMonkey and V8.
897
898
898
899
.. note::
899
900
@@ -911,8 +912,8 @@ function definitions
911
912
}
912
913
}
913
914
914
- The JavaScript code throws ``SyntaxError: In strict mode code,
915
- functions can only be declared at top level or immediately within
915
+ The JavaScript code throws ``SyntaxError: In strict mode code, you
916
+ may only declare functions at top level or immediately within
916
917
another function.``
917
918
918
919
String Generic Methods
@@ -923,7 +924,7 @@ V8 does not support `String generics
923
924
String generics are a set of methods on the ``String`` class that
924
925
mirror instance methods.
925
926
926
- .. example::
927
+ .. example::
927
928
928
929
The following use of the generic method
929
930
``String.toLowerCase()`` is **invalid** with V8:
@@ -959,7 +960,7 @@ With V8, use the ``String`` *instance* methods instead of following
959
960
960
961
* - ``String.concat()``
961
962
- ``String.search()``
962
- - ``String.toLowerCase()``
963
+ - ``String.toLowerCase()``
963
964
964
965
* - ``String.endsWith()``
965
966
- ``String.slice()``
@@ -983,10 +984,10 @@ With V8, use the ``String`` *instance* methods instead of following
983
984
984
985
.. _array-generics:
985
986
986
- Array Generics
987
- ^^^^^^^^^^^^^^
987
+ Array Generic Methods
988
+ ^^^^^^^^^^^^^^^^^^^^^
988
989
989
- V8 does not support `Array generics
990
+ V8 does not support `Array generic methods
990
991
<https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array#Array_generic_methods>`_.
991
992
Array generics are a set of methods on the ``Array`` class that mirror
992
993
instance methods.
@@ -1014,7 +1015,7 @@ instance methods.
1014
1015
1015
1016
var allEven = arr.every(isEven);
1016
1017
print(allEven);
1017
-
1018
+
1018
1019
With V8, use the ``Array`` *instance* methods instead of the following
1019
1020
*generic* methods:
1020
1021
@@ -1025,7 +1026,7 @@ With V8, use the ``Array`` *instance* methods instead of the following
1025
1026
- ``Array.slice()``
1026
1027
1027
1028
* - ``Array.every()``
1028
- - ``Array.map()``
1029
+ - ``Array.map()``
1029
1030
- ``Array.some()``
1030
1031
1031
1032
* - ``Array.filter()``
@@ -1056,11 +1057,11 @@ Use the ``Array`` instance method ``toString()`` instead.
1056
1057
1057
1058
V8 does not support the non-standard method ``uneval()``. Use the
1058
1059
standardized `JSON.stringify()
1059
- <https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/stringify>`_
1060
+ <https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/stringify>`_
1060
1061
method instead.
1061
1062
1062
- ``Map-Reduce`` and ``$where``
1063
- ``````````````````````````````````````
1063
+ Additional Limitations for ``Map-Reduce`` and ``$where``
1064
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1064
1065
1065
1066
In MongoDB 2.4, :doc:`map-reduce operations
1066
1067
</applications/map-reduce>`, the :command:`group` command, and
@@ -1084,14 +1085,14 @@ in MongoDB 2.4:
1084
1085
1085
1086
* - Available Properties
1086
1087
- Available Functions
1087
- -
1088
+ -
1088
1089
1089
- * -
1090
+ * -
1090
1091
| ``args``
1091
1092
| ``MaxKey``
1092
1093
| ``MinKey``
1093
1094
1094
- -
1095
+ -
1095
1096
| ``assert()``
1096
1097
| ``BinData()``
1097
1098
| ``DBPointer()``
@@ -1106,7 +1107,7 @@ in MongoDB 2.4:
1106
1107
| ``ISODate()``
1107
1108
| ``isString()``
1108
1109
1109
- -
1110
+ -
1110
1111
| ``Map()``
1111
1112
| ``MD5()``
1112
1113
| ``NumberInt()``
0 commit comments