Skip to content

Commit

Permalink
Address AS feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmorisi committed Jul 22, 2024
1 parent 3667bbd commit 16e055c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 12 deletions.
23 changes: 21 additions & 2 deletions source/indexes/single-field-index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ single field within a collection's documents. They improve single field query an
performance, and support :manual:`TTL Indexes </core/index-ttl>` that automatically remove
documents from a collection after a certain amount of time or at a specific clock time.

When creating a single-field index, you must specify the following:

- The field on which to create the index
- The sort order for the indexed values (ascending or descending)

.. note::

The ``_id_`` index is an example of a single-field index. This index is automatically
Expand All @@ -38,7 +43,7 @@ database from the :atlas:`Atlas sample datasets </sample-data>`. To learn how to
free MongoDB Atlas cluster and load the sample datasets, see the
:atlas:`Get Started with Atlas </getting-started>` guide.

The documents in this collection are modeled by the following {+language+} data class:
The following {+language+} data class models the documents in this collection:

.. literalinclude:: /includes/indexes/indexes.kt
:start-after: start-movie-class
Expand Down Expand Up @@ -74,4 +79,18 @@ The following is an example of a query that is covered by the index created in t

Movie(id=573a1398f29313caabceb515, title=Batman, ...)

To learn more, see :manual:`Single Field Indexes </core/index-single>` in the {+mdb-server+} manual.
Additional Information
----------------------

To learn more about single-field indexes, see :manual:`Single Field Indexes </core/index-single>`
in the {+mdb-server+} manual.

API Documentation
~~~~~~~~~~~~~~~~~

To learn more about any of the methods or types discussed in this
guide, see the following API Documentation:

- `find() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-mongo-collection/find.html>`__
- `filter() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-find-iterable/filter.html>`__
- `sort() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-find-iterable/sort.html/>`__
17 changes: 7 additions & 10 deletions source/work-with-indexes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,11 @@ your application's queries and operations that return sorted results. Each
index that you add consumes disk space and memory when active, so we recommend
that you track index memory and disk usage for capacity planning. In addition,
when a write operation updates an indexed field, MongoDB updates the related
index.
index, which can negatively impact performance for write operations.

Because MongoDB supports dynamic schemas, applications can query against fields
whose names are not known in advance or are arbitrary. MongoDB 4.2 introduced
:manual:`wildcard indexes </core/index-wildcard/>` to help support these
queries. Wildcard indexes are not designed to replace workload-based index
planning.
You can use :manual:`wildcard indexes </core/index-wildcard/>` in your MongoDB application
to query against fields whose names are not known in advance or are arbitrary. Wildcard
indexes are not designed to replace workload-based index planning.

For more information about designing your data model and choosing indexes appropriate for your application, see the
:manual:`Data Modeling and Indexes </core/data-model-operations/#indexes>` guide
Expand All @@ -64,7 +62,7 @@ free MongoDB Atlas cluster and load the sample datasets, see the
Create an Index
---------------

MongoDB supports several different index types to support querying your data.
MongoDB supports several different index types to help query your data.
The following pages describe the most common index types and provide sample
code for creating each index type.

Expand All @@ -79,7 +77,7 @@ Remove an Index
You can remove any unused index except the default unique index on the
``_id`` field.

The following sections show how to remove a single index or to remove all
The following sections show how to remove a single index or how to remove all
indexes in a collection.

Delete a Single Index
Expand All @@ -105,8 +103,7 @@ collection:
Delete All Indexes
~~~~~~~~~~~~~~~~~~

Starting with MongoDB 4.2, you can drop all indexes by calling the
``dropIndexes()`` method on your collection:
You can drop all indexes by calling the ``dropIndexes()`` method on your collection:

.. literalinclude:: /includes/indexes/indexes.kt
:language: kotlin
Expand Down

0 comments on commit 16e055c

Please sign in to comment.