Skip to content

Commit 17f6711

Browse files
committed
Address NR feedback
1 parent c37d778 commit 17f6711

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

source/fundamentals/indexes.txt

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
309311
Text Indexes
310312
~~~~~~~~~~~~
311313

@@ -424,28 +426,31 @@ in the {+mdb-server+} manual.
424426
Unique Indexes
425427
~~~~~~~~~~~~~~
426428

429+
.. _unique-indexes:
430+
427431
Unique indexes ensure that the indexed fields do not store duplicate values. By default, MongoDB creates a unique index
428432
on the ``_id`` field during the creation of a collection. To create a unique index, specify the field or combination of
429433
fields that you want to prevent duplication on and set the ``unique`` option to ``true``.
430434

431435
The 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

450455
Wildcard Indexes
451456
~~~~~~~~~~~~~~~~
@@ -590,4 +595,4 @@ For prior versions of MongoDB, pass "*" as a parameter to your call to
590595
For 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()>`__

source/usage-examples.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ to learn how to allow connections to your instance of Atlas and to find the
6666
:manual:`connection string </reference/connection-string/>` you use to replace the
6767
``uri`` variable in usage examples. If your instance uses
6868
:manual:`SCRAM authentication </core/security-scram/>`, you can replace
69-
``<db_username>`` with your username, ``<db_password>`` with your password, and
69+
``<db_username>`` with your database username, ``<db_password>`` with your database password, and
7070
``<cluster-url>`` with the IP address or URL of your instance.
7171

7272
For more information about connecting to your MongoDB instance, see our

0 commit comments

Comments
 (0)