IndexType

Specifies the different index types which are available for index creation.

Values

ValueMeaning
legacy2D"2d"

Legacy 2D plane index used in MongoDB 2.2 and earlier. Doesn't support GeoJSON objects. Uses planar geometry to return results.

See_Also: https://docs.mongodb.com/manual/core/2d/

sphere2D"2dsphere"

2D sphere index that calculates geometries on an earth-like sphere. Supports storing as GeoJSON objects.

See_Also: https://docs.mongodb.com/manual/core/2dsphere/

geoHaystack"geoHaystack"

A geoHaystack index is a special index that is optimized to return results over small areas. geoHaystack indexes improve performance on queries that use flat geometry.

See_Also: https://docs.mongodb.com/manual/core/geohaystack/

text"text"

Creates a text index which supports searching for string content in a collection. These text indexes do not store language-specific stop words and stem the words in a collection to only store root words.

See_Also: https://docs.mongodb.com/manual/core/index-text/

hashed"hashed"

To support hash based sharding, MongoDB provides a hashed index type, which indexes the hash of the value of a field. These indexes have a more random distribution of values along their range, but only support equality matches and cannot support range-based queries.

See_Also: https://docs.mongodb.com/manual/core/index-hashed/

See Also

Meta