@@ -306,6 +306,8 @@ The following code shows how to delete a search index from a collection:
306306 :start-after: start drop-search-index
307307 :end-before: end drop-search-index
308308
309+ .. _text-indexes:
310+
309311Text Indexes
310312~~~~~~~~~~~~
311313
@@ -424,28 +426,31 @@ in the {+mdb-server+} manual.
424426Unique Indexes
425427~~~~~~~~~~~~~~
426428
429+ .. _unique-indexes:
430+
427431Unique indexes ensure that the indexed fields do not store duplicate values. By default, MongoDB creates a unique index
428432on the ``_id`` field during the creation of a collection. To create a unique index, specify the field or combination of
429433fields that you want to prevent duplication on and set the ``unique`` option to ``true``.
430434
431435The following example creates a unique, descending index on the ``theaterId`` field:
432436
433- .. literalinclude::
434- :language: csharp
437+ .. literalinclude:: /includes/fundamentals/code-snippets/IndexPage.java
438+ :language: java
435439 :dedent:
436440 :start-after: begin unique index
437441 :end-before: end unique index
438442
439- If you attempt to perform a write operation that stores a duplicate value
440- that violates the unique index, MongoDB will throw an error that resembles
441- the following:
443+ .. important::
442444
443- .. code-block:: none
444- :copyable: false
445+ If you perform a write operation that stores a duplicate value that violates the unique index, the MongoDB
446+ Java driver raises a ``DuplicateKeyException``, and MongoDB throws an error resembling the following:
447+
448+ .. code-block:: none
449+ :copyable: false
445450
446- E11000 duplicate key error index
451+ E11000 duplicate key error index
447452
448- To learn more, see :manual:`Unique Indexes </core/index-unique>`.
453+ For more information , see the :manual:`Unique Indexes</core/index-unique>` page in the {+mdb-server+} manual .
449454
450455Wildcard Indexes
451456~~~~~~~~~~~~~~~~
@@ -590,4 +595,4 @@ For prior versions of MongoDB, pass "*" as a parameter to your call to
590595For more information about the methods in this section, see the following API Documentation:
591596
592597- `dropIndex() <{+api+}/apidocs/mongodb-driver-sync/com/mongodb/client/MongoCollection.html#dropIndex(java.lang.String)>`__
593- - `dropIndexes() <{+api+}/apidocs/mongodb-driver-sync/com/mongodb/client/MongoCollection.html#dropIndexes()>`__
598+ - `dropIndexes() <{+api+}/apidocs/mongodb-driver-sync/com/mongodb/client/MongoCollection.html#dropIndexes()>`__
0 commit comments