Skip to content

(DOCSP-10774): Updating out of date instructions for Compass indexes #4148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 2 additions & 55 deletions source/includes/driver-examples/driver-example-indexes-1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,62 +32,9 @@
the collection must contain documents.

To create an index in
:ref:`MongoDB Compass <compass-index>`, complete the following
steps:
:ref:`MongoDB Compass <compass-index>`:

1. Navigate to the collection for which you wish to create
the index:

a. In the left-hand MongoDB Compass navigation pane, click
the database to which your target collection belongs.

b. From the database view, click the target collection name.

#. Click the :guilabel:`Indexes` tab:

.. figure:: /images/compass-index-tab.png
:alt: Compass index tab

.. raw:: html

<br>

#. Click the :guilabel:`Create Index` button:

.. figure:: /images/compass-create-index-button.png
:alt: Compass index button

.. raw:: html

<br>

The following dialog appears:

.. figure:: /images/compass-index-dialog.png
:scale: 60 %
:alt: Compass index dialog

#. (Optional) Enter the index name.

Leaving this field blank causes |compass| to create a
default name for the index.

#. Add fields to the index.

Use the :guilabel:`Configure the index definition` section
of the dialog to define the fields for your index and
their respective types. To create an index on multiple
fields, click :guilabel:`Add another field`.

#. (Optional) Specify the index options.

The following index options can be specified:

- Create a :ref:`unique index <unique-index>`
- Create :ref:`TTL <ttl-index>`
- Partial :ref:`filter expression <partial-index>`

#. Click :guilabel:`Create` to create the index.
.. include:: /includes/steps/create-index-compass.rst

- id: python
content: |
Expand Down
10 changes: 7 additions & 3 deletions source/includes/driver-examples/driver-example-indexes-2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@
- id: compass
content: |

.. important::

|compass| does not support collation for indexes.
.. note::

The following examples illustrate indexes and collation in
the :doc:`Mongo Shell </mongo/>`.

Refer to the
:hardlink:`MongoDB Compass Documentation
</compass/current/indexes/>` for instructions on using
custom collation with indexes in Compass.


- id: python
content: |
.. include:: /includes/fact-collation-driver.rst
Expand Down
103 changes: 103 additions & 0 deletions source/includes/steps-create-index-compass.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
title: Navigate to the collection for which you wish to create the index.
level: 4
ref: navigate-to-collection
content: |

a. In the left-hand MongoDB Compass navigation pane, click the
database that contains your desired collection.

#. From the database view, click the target collection name.
---
title: Click the :guilabel:`Create Index` button.
level: 4
ref: create-collection
content: |
From the :ref:`Indexes <collection-tab>` tab, click the
:guilabel:`Create Index` button to bring up the
:guilabel:`Create Index` dialog.
---
title: Optional. Enter the index name.
level: 4
ref: enter-index-name
content: |
In the dialog, enter the name of the index to create, or leave blank
to have MongoDB create a default name for the index.
---
title: Add fields to index.
level: 4
ref: index-fields
content: |
To specify a key for the index, select the field and the index type.
To index additional fields, click :guilabel:`Add Another Field`.
---
title: Optional. Specify the index options.
level: 4
ref: index-options
content: |

Compass supports the following index options:

.. list-table::
:header-rows: 1
:widths: 40 60 20

* - Option
- Description
- More Information

* - Build index in the background

- If checked, ensure that the MongoDB deployment remains
available during the index build operation.

- :manual:`Background Construction </core/index-creation/index.html#background-construction>`

* - Create unique index

- If checked, ensure that the indexed fields do not
store duplicate values.

- :manual:`Unique Indexes </core/index-unique>`

* - Create :abbr:`TTL (Time to Live)`

- If checked, automatically delete documents after a
specified number of seconds since the indexed field value.

- :manual:`TTL Indexes </core/index-ttl>`

* - Partial filter expression

- If checked, only index documents which match the specified
filter expression.

.. example::

The following partial filter expression only indexes
documents where the ``timezone`` field exists:

.. code-block:: js

{ "timezone": { "$exists": true } }

- :manual:`Partial Indexes </core/index-partial/>`

* - Use custom collation

- If checked, create a custom collation for the index
using the options provided in Compass.

- :manual:`Collation Document </reference/collation/#collation-document>`

* - Wildcard projection (*New in MongoDB 4.2*)

- If checked, support unknown or arbitrary fields
which match the specified projection in the index.

- :manual-next:`Wildcard Indexes </core/index-wildcard/>`
---
title: Click :guilabel:`Create` to create the index.
level: 4
ref: create-index-button
content: ""
...