diff --git a/reference/mongo/mongocollection/ensureindex.xml b/reference/mongo/mongocollection/ensureindex.xml index edd23f368e..dba8d549b6 100644 --- a/reference/mongo/mongocollection/ensureindex.xml +++ b/reference/mongo/mongocollection/ensureindex.xml @@ -60,9 +60,11 @@ - A unique index cannot be created on a field if multiple existing documents do - not contain the field. The field is effectively &null; for these documents - and thus already non-unique. + A unique index cannot be created on a field if multiple existing + documents do not contain the field. The field is effectively &null; + for these documents and thus already non-unique. Sparse indexing may + be used to overcome this, since it will prevent documents without the + field from being indexed. @@ -75,6 +77,32 @@ all but one duplicate value. + + + "sparse" + + + Create a sparse index, which only includes documents containing the + field. This option is only compatible with single-field indexes. + + + + + "expireAfterSeconds" + + + The value of this option should specify the number of seconds after + which a document should be considered expired and automatically + removed from the collection. This option is only compatible with + single-field indexes where the field will contain + MongoDate values. + + + This feature is available in MongoDB 2.2+. See + Expire Data from Collections by Setting TTL + for more information. + + "background"