The Index Management tab in the Developer module allows you to manage the indexes of the selected database collection.
The upper part of the page allows you to select the database and collection, and search the list of indexes, as well as action buttons that you can perform on the collection. The lower part of the page displays the indexes for the selected collection and the action icons that can be performed on the indexes.
In this page, you can perform the following:
- Select database collection
- Add index
- Edit index
- Copy index
- Delete index
All database collections have an index on _id created by default, which is not editable.
To display the indexes of a collection, select the desired database in the “Database” field and select the desired collection in the “Collection” field. The indexes of the selected collection will be displayed in the panel below.
To add an index to the collection, click on the “Add” button at the upper right of the page.
The “Add” panel will appear.
|Field||Description||Input Type||Default Value|
|Index Name||Name of new current index.||Textbox||None|
|Index Key||Code for new key.||Textbox||None|
|Unique||If selected, creates an unique index.||Checkbox||Not selected|
|Create Index in Background||If selected, creates index in the background.||Checkbox||Selected|
|Sparse||If selected, index only references documents with specified field.||Checkbox||Not selected|
|Select Default Language||Defines the language to be used.||Drop-down list||English|
In the Basic section, key in the unique name for the new index in the “Index Name” field. Key in the desired code in the “Index Key” field.
The Advanced section list the available options for the index types. Multiple selection is allowed. In this case, three options are available:
- Unique - Creates an unique index so that the collection will not accept insertion or update of documents where the index key value matches a existing value in the index
- Create Index in Background - If selected, creates index in the background
- Sparse - If selected, the index only reference documents with the specified field
In the “Text Search” section, select the desired language from the drop-down list in the “Select Default Language” field.
Click on the “Save” button at the upper right corner of the panel to save the new index.
A notification will appear once the new index is created.
Error message will appear if any of the fields are entered or selected incorrectly. Below is an example.
If the “Unique” option is selected for the index, a green tick will appear under the “Unique” column corresponding that index. Those indexes that do not select the “Unique” option will have red crosses under the “Unique” column.
To edit the properties of an index, click on the “Edit” icon under the “Actions” column corresponding the desired index.
The “Edit” panel will appear.
Except for the “Index Name” field, edit the other fields as necessary and click on the “Save” button to save the changes.
A notification will appear after the index is saved.
You can copy the index from the current collection to another collection. To do so, click on the “Copy” icon under the “Actions” column corresponding the desired index.
The “Copy Collection’s Index” dialog box will appear.
|Field||Description||Input Type||Default Value|
|Current Index Name||Name of the current index (not editable).||Textbox||As selected|
|New Index Name||Name of the new index.||Textbox||As in “Current Index Name”|
|Database||List of database available.||Drop-down list||Name of current database|
|Collection||List of collections available.||Drop-down list||First collection in “Database”|
In the “New Index Name” field, the default index name is used. Change to the appropriate name if the default name is not desired. The “Database” field shows are current database of the selected index. Change to the appropriate database. In the “Copy to Collection” field, select the collect to copy the index to and click on the “Copy” button to copy the index.
A notification will appear after the index has been successfully copied to the other collection.
If the index already exist in the other collection, an error message will appear.
To delete an index, click on the “Delete” icon under the “Actions” column corresponding the desired index.
A notification will appear after the index is deleted.
The “Refresh” button at the upper right corner of the Index Management page allows you to refresh the page in case the collection is being updated.
There is a cross-field search function for the list of indexes.
This provides an easy way to search through the indexes. It is case-insensitive and displays indexes that have the entered search value in any of the values of the fields below:
- Index Name