Skip to content

DOCS-1198 add the where,mapreduce, group restrictions in 2.4 release not... #730

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 1 addition & 20 deletions source/faq/developers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
58 changes: 58 additions & 0 deletions source/includes/fact-group-map-reduce-where-limitations-in-24.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
In MongoDB 2.4, :doc:`map-reduce operations
</applications/map-reduce>`, 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 </applications/map-reduce>`,
: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 </applications/map-reduce>`, 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()``
20 changes: 20 additions & 0 deletions source/includes/fact-sort-order.rst
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 2 additions & 0 deletions source/reference/aggregation/sort.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 14 additions & 10 deletions source/reference/command/group.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 <limit-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 <limit-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
Expand Down Expand Up @@ -262,5 +266,5 @@ group
"ok" : 1 }

.. seealso:: :doc:`/applications/aggregation`

.. read-lock
6 changes: 6 additions & 0 deletions source/reference/command/mapReduce.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions source/reference/method/cursor.sort.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions source/reference/method/db.collection.group.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions source/reference/method/db.collection.mapReduce.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions source/reference/operator/where.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
59 changes: 1 addition & 58 deletions source/release-notes/2.4.txt
Original file line number Diff line number Diff line change
Expand Up @@ -991,63 +991,6 @@ all changes .
Additional Limitations for Map-Reduce and ``$where`` Operations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In MongoDB 2.4, :doc:`map-reduce operations
</applications/map-reduce>`, 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 </applications/map-reduce>`,
: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 </applications/map-reduce>`, 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