This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision |
mongo_management [2020/12/16 09:37] – andonovj | mongo_management [2020/12/16 09:42] (current) – [Index] andonovj |
---|
| |
====Index==== | ====Index==== |
Indexes help with searching through mongo, as such there are a lot of indexes, depending what you need: | Indexes support the efficient execution of queries in MongoDB. Without indexes, MongoDB must perform a collection scan, i.e. scan every document in a collection, to select those documents that match the query statement. If an appropriate index exists for a query, MongoDB can use the index to limit the number of documents it must inspect. |
| |
| Indexes are special data structures [1] that store a small portion of the collection’s data set in an easy to traverse form. The index stores the value of a specific field or set of fields, ordered by the value of the field. The ordering of the index entries supports efficient equality matches and range-based query operations. In addition, MongoDB can return sorted results by using the ordering in the index. |
| |
| The following diagram illustrates a query that selects and orders the matching documents using an index: |
| |
| {{:mongoindexoverview.jpg?600|}} |
| |
===Index types=== | ===Index types=== |