diff --git a/source/core/document.txt b/source/core/document.txt index a6971e2b066..749c1b04bd6 100644 --- a/source/core/document.txt +++ b/source/core/document.txt @@ -65,6 +65,8 @@ The above fields have the following data types: - ``views`` holds a value of the *NumberLong* type. +.. _document-field-names: + Field Names ~~~~~~~~~~~ diff --git a/source/reference/bson-type-comparison-order.txt b/source/reference/bson-type-comparison-order.txt index 2471d691342..b8d99449e5c 100644 --- a/source/reference/bson-type-comparison-order.txt +++ b/source/reference/bson-type-comparison-order.txt @@ -55,6 +55,17 @@ when comparing a field whose value is a single-element array (e.g. ``[ ``1`` and ``2``. A comparison of an empty array (e.g. ``[ ]``) treats the empty array as less than ``null`` or a missing field. +Objects +------- + +The comparison of BSON objects uses the following order: + +#. Recursively compare key/value pairs in the order they appear within the BSON object. +#. Compare the :ref:`key field names `. +#. If the key field names are equal, compare the field values. +#. If the field values are equal, compare the next key/value pair (return to step 1). An object without further pairs is lesser than an object with further pairs. + + Dates and Timestamps --------------------