Skip to content

DOCS-1411: Clarifications on BSON field ordering #1220

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 1 commit 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
12 changes: 11 additions & 1 deletion source/core/document.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,22 @@ existing user document.
Document Limitations
--------------------

Record documents have the following attributes:
Documents have the following attributes:

- .. include:: /includes/fact-document-max-size.rst

- .. include:: /includes/fact-document-field-name-restrictions.rst

- MongoDB does not make guarantees regarding the order of fields in
a BSON document. Drivers and MongoDB will reorder the fields of a
documents upon insertion and following updates.

Most programming languages represent BSON documents with some form
of :term:`mapping type <mapping types>`. Comparisons between mapping typed objects
depend on order. As a result, the only way to ensure that two
documents have the same set of field and value pairs is to compare
each field and value individually.

The ``_id`` Field
-----------------

Expand Down
8 changes: 8 additions & 0 deletions source/reference/glossary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,14 @@ Glossary
management. For information on LVM and MongoDB, see
:ref:`lvm-backup-and-restore`.

mapping types
Structures in programming languages that associate keys with
values, where keys may nest other pairs of keys and values
(e.g. dictionaries, hashes, maps, and associative arrays).
The properties of these structures depend on the language
specification and implementation. But generally these structures
are not strictly ordered.

map-reduce
A data processing and aggregation paradigm consisting of a "map"
phase that selects data and a "reduce" phase that transforms the
Expand Down