Skip to content
Closed
Show file tree
Hide file tree
Changes from 5 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
11 changes: 11 additions & 0 deletions source/core/indexes-introduction.txt
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,17 @@ You can combine the sparse index option with the unique index option
to reject documents that have duplicate values for a field but ignore
documents that do not have the indexed key.

TTL Indexes
~~~~~~~~~~~

:doc:`TTL indexes </core/index-ttl>` are special indexes that MongoDB
can use to automatically remove documents from a collection after a
certain amount of time. This is ideal for some types of information
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: s/some/certain/

like machine generated event data, logs, and session information that
only need to persist in a database for a limited amount of time.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: s/limited/finite/


See: :doc:`/tutorial/expire-data` for implementation instructions.

Index Intersection
------------------

Expand Down
6 changes: 3 additions & 3 deletions source/includes/toc-sharded-cluster-architectures.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ description: |
---
file: /core/sharded-cluster-architectures-production
description: |
Sharded cluster for production has component requirements to provide
redundancy and high availability.
Outlines the components required to deploy a redundant and
highly available sharded cluster.
---
file: /core/sharded-cluster-architectures-test
description: |
Sharded clusters for testing and development can have
Sharded clusters for testing and development can include
fewer components.
...
4 changes: 4 additions & 0 deletions source/reference/operator/aggregation/group.txt
Original file line number Diff line number Diff line change
Expand Up @@ -240,3 +240,7 @@ The operation returns the following documents:
{ "_id" : 8645, "title" : "Eclogues", "author" : "Dante", "copies" : 2 }
]
}

.. seealso:: The :doc:`/tutorial/aggregation-zip-code-data-set`
tutorial provides an extensive example of the :pipeline:`$group`
operator in a common use case.
4 changes: 2 additions & 2 deletions source/reference/operator/query/all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,13 @@ you may use the :query:`$all` operator to select against a non-array

.. code-block:: javascript

db.inventory.find( { qty: { $all: [ 50 ] } } )
db.inventory.find( { "qty.num": { $all: [ 50 ] } } )

**However**, use the following form to express the same query:

.. code-block:: javascript

db.inventory.find( { qty: 50 } )
db.inventory.find( { "qty.num" : 50 } )

Both queries will select all documents in the ``inventory``
collection where the value of the ``qty`` field equals ``50``.
Expand Down
12 changes: 8 additions & 4 deletions source/tutorial/create-a-unique-index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,14 @@ The :ref:`_id index <index-type-id>` is a unique index. In some
situations you may consider using the ``_id`` field itself for this kind
of data rather than using a unique index on another field.

In many situations you will want to combine the ``unique`` constraint
with the ``sparse`` option. When MongoDB indexes a field, if a
document does not have a value for a field, the index entry for that
item will be ``null``. Since unique indexes cannot have duplicate
When MongoDB indexes a field, if a
document does not have a value for that field, the index entry for that
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would omit the 2nd comma or reverse the ordering to make a clearer conditional:

'If a document does not have a value for a field, the entry for that item will be null in any index that includes it' or some such.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh thank goodness. I tried to rephrase that like, six times, and failed.

item will be ``null``.
Thus, in many situations you will want to combine the ``unique`` constraint
with the ``sparse`` option. ``Sparse`` indexes skip over any
document that is missing the indexed field, rather than storing
``null`` for the index entry. Since unique indexes
cannot have duplicate
values for a field, without the ``sparse`` option, MongoDB will reject
the second document and all subsequent documents without the indexed
field. Consider the following prototype.
Expand Down