diff --git a/source/applications/optimization.txt b/source/applications/optimization.txt index 93bb4176546..b26b6e2f9a9 100644 --- a/source/applications/optimization.txt +++ b/source/applications/optimization.txt @@ -66,8 +66,9 @@ order, the direction of a single-key index does not matter. Indexes support queries, update operations, and some phases of the :ref:`aggregation pipeline -` for more -information. +`. + +.. include:: /includes/fact-bindata-storage-optimization.rst Limit Results ~~~~~~~~~~~~~ diff --git a/source/core/document.txt b/source/core/document.txt index efbc46896fb..5bde2f7da35 100644 --- a/source/core/document.txt +++ b/source/core/document.txt @@ -233,10 +233,11 @@ Consider the following options for the value of an ``_id`` field: :doc:`/tutorial/create-an-auto-incrementing-field` tutorial for an implementation pattern. -- Generate a UUID in your application code. For efficiency, store - the UUID as a value of the BSON ``BinData`` type to reduce the - size of UUID values as stored in the collection and in the ``_id`` - index. +- Generate a UUID in your application code. For a more efficient + storage of the UUID values in the collection and in the ``_id`` + index, store the UUID as a value of the BSON ``BinData`` type. + + .. include:: /includes/fact-bindata-storage-optimization.rst - Use your driver's BSON UUID facility to generate UUIDs. Be aware that driver implementations may implement UUID serialization and diff --git a/source/includes/fact-bindata-storage-optimization.rst b/source/includes/fact-bindata-storage-optimization.rst new file mode 100644 index 00000000000..6094901bf1b --- /dev/null +++ b/source/includes/fact-bindata-storage-optimization.rst @@ -0,0 +1,7 @@ +Index keys that are of the ``BinData`` type are more efficiently stored +in the index if: + +- the binary subtype value is in the range of 0-7 or 128-135, and + +- the length of the byte array is: 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, + 14, 16, 20, 24, or 32.