From 1d505cd2effbc29186162ae411060da592e97128 Mon Sep 17 00:00:00 2001 From: kay Date: Fri, 15 Mar 2013 13:25:50 -0400 Subject: [PATCH 1/2] DOCS-1198 add the where,mapreduce, group restrictions in 2.4 release notes to the actual where, mapreduce and group manual pages as well --- ...oup-map-reduce-where-limitations-in-24.rst | 58 ++++++++++++++++++ source/reference/command/group.txt | 24 ++++---- source/reference/command/mapReduce.txt | 6 ++ .../reference/method/db.collection.group.txt | 4 ++ .../method/db.collection.mapReduce.txt | 6 ++ source/reference/operator/where.txt | 6 ++ source/release-notes/2.4.txt | 59 +------------------ 7 files changed, 95 insertions(+), 68 deletions(-) create mode 100644 source/includes/fact-group-map-reduce-where-limitations-in-24.rst diff --git a/source/includes/fact-group-map-reduce-where-limitations-in-24.rst b/source/includes/fact-group-map-reduce-where-limitations-in-24.rst new file mode 100644 index 00000000000..32906bfbd15 --- /dev/null +++ b/source/includes/fact-group-map-reduce-where-limitations-in-24.rst @@ -0,0 +1,58 @@ +In MongoDB 2.4, :doc:`map-reduce operations +`, the :dbcommand:`group` command, and +:operator:`$where` operator expressions **cannot** access certain +global functions or properties, such as ``db``, that are available +in the :program:`mongo` shell. + +When upgrading to MongoDB 2.4, you will need to refactor your code if +your :doc:`map-reduce operations `, +:dbcommand:`group` commands, or :operator:`$where` operator expressions +include any global shell functions or properties that are no longer +available, such as ``db``. + +The following shell functions and properties **are available** to +:doc:`map-reduce operations `, the +:dbcommand:`group` command, and :operator:`$where` operator expressions +in MongoDB 2.4: + +.. list-table:: + :header-rows: 1 + + * - Available Properties + - Available Functions + - + + * - + | ``args`` + | ``MaxKey`` + | ``MinKey`` + + - + | ``assert()`` + | ``BinData()`` + | ``DBPointer()`` + | ``DBRef()`` + | ``doassert()`` + | ``emit()`` + | ``gc()`` + | ``HexData()`` + | ``hex_md5()`` + | ``isNumber()`` + | ``isObject()`` + | ``ISODate()`` + | ``isString()`` + + - + | ``Map()`` + | ``MD5()`` + | ``NumberInt()`` + | ``NumberLong()`` + | ``ObjectId()`` + | ``print()`` + | ``sleep()`` + | ``Timestamp()`` + | ``tojson()`` + | ``tojsononeline()`` + | ``tojsonObject()`` + | ``UUID()`` + | ``version()`` diff --git a/source/reference/command/group.txt b/source/reference/command/group.txt index 8e901780459..5324ff02714 100644 --- a/source/reference/command/group.txt +++ b/source/reference/command/group.txt @@ -76,17 +76,21 @@ group - The :dbcommand:`group` command takes a read lock and does not allow any other threads to execute JavaScript while it is running. - + .. note:: - The result set must fit within the :ref:`maximum BSON document - size `. - - Additionally, in version 2.2, the returned array can contain at most 20,000 - elements; i.e. at most 20,000 unique groupings. For group by - operations that results in more than 20,000 unique groupings, use - :dbcommand:`mapReduce`. Previous versions had a limit of 10,000 - elements. + - The result set must fit within the :ref:`maximum BSON document + size `. + + - Additionally, in version 2.2, the returned array can contain at + most 20,000 elements; i.e. at most 20,000 unique groupings. For + group by operations that results in more than 20,000 unique + groupings, use :dbcommand:`mapReduce`. Previous versions had a + limit of 10,000 elements. + + .. versionchanged:: 2.4 + + - .. include:: /includes/fact-group-map-reduce-where-limitations-in-24.rst For the shell, MongoDB provides a wrapper method :method:`db.collection.group()`; however, the @@ -262,5 +266,5 @@ group "ok" : 1 } .. seealso:: :doc:`/applications/aggregation` - + .. read-lock diff --git a/source/reference/command/mapReduce.txt b/source/reference/command/mapReduce.txt index d4effc8f9eb..091cd36ebca 100644 --- a/source/reference/command/mapReduce.txt +++ b/source/reference/command/mapReduce.txt @@ -55,6 +55,12 @@ mapReduce } ) +.. note:: + + .. versionchanged:: 2.4 + + .. include:: /includes/fact-group-map-reduce-where-limitations-in-24.rst + .. include:: /includes/parameters-map-reduce.rst :start-after: stop-parameters-here diff --git a/source/reference/method/db.collection.group.txt b/source/reference/method/db.collection.group.txt index 87e0fdaaa5d..1fc512f19db 100644 --- a/source/reference/method/db.collection.group.txt +++ b/source/reference/method/db.collection.group.txt @@ -72,6 +72,10 @@ db.collection.group() use :dbcommand:`mapReduce`. Previous versions had a limit of 10,000 elements. + .. versionchanged:: 2.4 + + - .. include:: /includes/fact-group-map-reduce-where-limitations-in-24.rst + Consider the following examples of the :method:`db.collection.group()` method: The examples assume an ``orders`` collection with documents of the diff --git a/source/reference/method/db.collection.mapReduce.txt b/source/reference/method/db.collection.mapReduce.txt index 787db73061e..4c9d0f8c5ef 100644 --- a/source/reference/method/db.collection.mapReduce.txt +++ b/source/reference/method/db.collection.mapReduce.txt @@ -31,6 +31,12 @@ db.collection.mapReduce() .. include:: /includes/parameters-map-reduce.rst :end-before: stop-parameters-here + .. note:: + + .. versionchanged:: 2.4 + + .. include:: /includes/fact-group-map-reduce-where-limitations-in-24.rst + .. include:: /includes/parameters-map-reduce.rst :start-after: stop-parameters-here diff --git a/source/reference/operator/where.txt b/source/reference/operator/where.txt index 26fd9cab8cc..c6d3d1d5106 100644 --- a/source/reference/operator/where.txt +++ b/source/reference/operator/where.txt @@ -69,3 +69,9 @@ $where - The non\-:operator:`$where` query statements may use an :term:`index`. + + .. note:: + + .. versionchanged:: 2.4 + + .. include:: /includes/fact-group-map-reduce-where-limitations-in-24.rst diff --git a/source/release-notes/2.4.txt b/source/release-notes/2.4.txt index 9101bbac668..f62fc606a80 100644 --- a/source/release-notes/2.4.txt +++ b/source/release-notes/2.4.txt @@ -991,63 +991,6 @@ all changes . Additional Limitations for Map-Reduce and ``$where`` Operations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -In MongoDB 2.4, :doc:`map-reduce operations -`, the :command:`group` command, and -:operator:`$where` operator expressions **cannot** access certain -global functions or properties, such as ``db``, that are available in -the :program:`mongo` shell. - -When upgrading to MongoDB 2.4, you will need to refactor your code if -your :doc:`map-reduce operations `, -:command:`group` commands, or :operator:`$where` operator expressions -include any global shell functions or properties that are no longer -available, such as ``db``. - -The following shell functions and properties **are available** to -:doc:`map-reduce operations `, the -:command:`group` command, and :operator:`$where` operator expressions -in MongoDB 2.4: - -.. list-table:: - :header-rows: 1 - - * - Available Properties - - Available Functions - - - - * - - | ``args`` - | ``MaxKey`` - | ``MinKey`` - - - - | ``assert()`` - | ``BinData()`` - | ``DBPointer()`` - | ``DBRef()`` - | ``doassert()`` - | ``emit()`` - | ``gc()`` - | ``HexData()`` - | ``hex_md5()`` - | ``isNumber()`` - | ``isObject()`` - | ``ISODate()`` - | ``isString()`` - - - - | ``Map()`` - | ``MD5()`` - | ``NumberInt()`` - | ``NumberLong()`` - | ``ObjectId()`` - | ``print()`` - | ``sleep()`` - | ``Timestamp()`` - | ``tojson()`` - | ``tojsononeline()`` - | ``tojsonObject()`` - | ``UUID()`` - | ``version()`` +.. include:: /includes/fact-group-map-reduce-where-limitations-in-24.rst .. DOCS-752 From f41f053f5a10fa2fe18b7bc7e019ecf4e6e47a53 Mon Sep 17 00:00:00 2001 From: kay Date: Fri, 15 Mar 2013 14:01:42 -0400 Subject: [PATCH 2/2] DOCS-1022 sort heterogeneous type -- need to backport --- source/faq/developers.txt | 21 +-------------------- source/includes/fact-sort-order.rst | 20 ++++++++++++++++++++ source/reference/aggregation/sort.txt | 2 ++ source/reference/method/cursor.sort.txt | 2 ++ 4 files changed, 25 insertions(+), 20 deletions(-) create mode 100644 source/includes/fact-sort-order.rst diff --git a/source/faq/developers.txt b/source/faq/developers.txt index 7789b9562ae..8ab0536ed64 100644 --- a/source/faq/developers.txt +++ b/source/faq/developers.txt @@ -419,26 +419,7 @@ the following documents may exist within a single collection. { x: "string" } { x: 42 } -When comparing values of different :term:`BSON` types, MongoDB uses the following -compare order: - -- MinKey (internal type) -- Null -- Numbers (ints, longs, doubles) -- Symbol, String -- Object -- Array -- BinData -- ObjectID -- Boolean -- Date, Timestamp -- Regular Expression -- MaxKey (internal type) - -.. note:: - - MongoDB treats some types as equivalent for comparison purposes. - For instance, numeric types undergo conversion before comparison. +.. include:: /includes/fact-sort-order.rst Consider the following :program:`mongo` example: diff --git a/source/includes/fact-sort-order.rst b/source/includes/fact-sort-order.rst new file mode 100644 index 00000000000..ac9bb5e5fe0 --- /dev/null +++ b/source/includes/fact-sort-order.rst @@ -0,0 +1,20 @@ +When comparing values of different :term:`BSON` types, MongoDB uses the following +comparison order, from lowest to highest: + +#. MinKey (internal type) +#. Null +#. Numbers (ints, longs, doubles) +#. Symbol, String +#. Object +#. Array +#. BinData +#. ObjectID +#. Boolean +#. Date, Timestamp +#. Regular Expression +#. MaxKey (internal type) + +.. note:: + + MongoDB treats some types as equivalent for comparison purposes. + For instance, numeric types undergo conversion before comparison. diff --git a/source/reference/aggregation/sort.txt b/source/reference/aggregation/sort.txt index 7271c52d6b4..8a16205ab78 100644 --- a/source/reference/aggregation/sort.txt +++ b/source/reference/aggregation/sort.txt @@ -34,6 +34,8 @@ $sort (aggregation) in descending order according by the ``age`` field and then in ascending order according to the value in the ``posts`` field. + .. include:: /includes/fact-sort-order.rst + .. note:: The :pipeline:`$sort` cannot begin sorting documents until diff --git a/source/reference/method/cursor.sort.txt b/source/reference/method/cursor.sort.txt index 5cfc1f048ee..f09c71d1e5b 100644 --- a/source/reference/method/cursor.sort.txt +++ b/source/reference/method/cursor.sort.txt @@ -59,3 +59,5 @@ cursor.sort() disk. Typically, the order of documents on disks reflects insertion order, *except* when documents move internal because of document growth due to update operations. + + .. include:: /includes/fact-sort-order.rst