MongoDB Documentation, Release 3.0.4 8.2 Index Concepts These documents describe and provide examples of the types, configuration options, and behavior of indexes in Mon- goDB. For an over view of indexing, see Index Introduction (page 481). For operational instructions, see Indexing Tutorials (page 517). The Indexing Reference (page 552) documents the commands and operations specific to index construction, maintenance, and querying in MongoDB, including index types and creation options. MongoDB provides a number of different index types. You can create indexes on any field or embedded field within a document or embedded document. In general, you should create indexes that support your common and user-facing queries. Having these indexes will ensure that MongoDB scans the smallest possible number of documents. In the mongo shell, you can create an index by calling the createIndex() method. For more detailed instructions about building indexes, see the Indexing Tutorials (page 517) page. Chapter 8. Indexes 486 8.2.1 Index Types Index Types (page 486) MongoDB provides different types of indexes for different purposes and different types of content. Single Field Indexes (page 487) A single field index only includes data from a single field of the documents in a collection. MongoDB supports single field indexes on fields at the top level of a document and on fields in sub-documents. Compound Indexes (page 489) A compound index includes more than one field of the documents in a collec- tion. Multikey Indexes (page 491) A multikey index is an index on an array field, adding an index key for each value in the array. Geospatial Indexes and Queries (page 494) Geospatial indexes support location-based searches on data that is stored as either GeoJSON objects or legacy coordinate pairs. Text Indexes (page 500) Text indexes support search of string content in documents. Hashed Index (page 502) Hashed indexes maintain entries with hashes of the values of the indexed field and are primarily used with sharded clusters to support hashed shard keys. Index Properties (page 503) The properties you can specify when building indexes. TTL Indexes (page 503) The TTL index is used for TTL collections, which expire data after a period of time. Unique Indexes (page 504) A unique index causes MongoDB to reject all documents that contain a duplicate value for the indexed field. Sparse Indexes (page 505) A sparse index does not index documents that do not have the indexed field. Index Creation (page 507) The options available when creating indexes. Index Intersection (page 510) The use of index intersection to fulfill a query. Multikey Index Bounds (page 511) The computation of bounds on a multikey index scan. Single Field Indexes (page 487) A single field index only includes data from a single field of the documents in a collection. MongoDB supports single field indexes on fields at the top level of a document and on fields in sub-documents. Compound Indexes (page 489) A compound index includes more than one field of the documents in a collection. Multikey Indexes (page 491) A multikey index is an index on an array field, adding an index key for each value in the array.