diff --git a/source/tutorial/create-a-unique-index.txt b/source/tutorial/create-a-unique-index.txt index 0f20c360445..4ea91a4efd3 100644 --- a/source/tutorial/create-a-unique-index.txt +++ b/source/tutorial/create-a-unique-index.txt @@ -38,6 +38,15 @@ The :ref:`_id index ` is a unique index. In some situations you may consider using ``_id`` field itself for this kind of data rather than using a unique index on another field. +The unicity constraint prevents two documents from the collection to +have the same value, but it does not prevent one specific document to +have a value duplicated. For instance, a unique index on ``a.b`` +will let the following document exist: + +.. code-block:: javascript + + { "a" : [ { "b": 1 }, { "b" : 1 } ] } + 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