Docs Menu

Indexing Reference

On this page

  • Indexing Methods in the mongo Shell
  • Indexing Database Commands
  • Geospatial Query Selectors
  • Indexing Query Modifiers
Name
Description
Builds an index on a collection.
Removes a specified index on a collection.
Removes all indexes on a collection.
Returns an array of documents that describe the existing indexes on a collection.
Rebuilds all existing indexes on a collection.
Reports the total size used by the indexes on a collection. Provides a wrapper around the totalIndexSize field of the collStats output.
Reports on the query execution plan for a cursor.
Forces MongoDB to use a specific index for a query.
Specifies an exclusive upper index bound for a cursor. For use with cursor.hint()
Specifies an inclusive lower index bound for a cursor. For use with cursor.hint()
Name
Description
Builds one or more indexes for a collection.
Removes indexes from a collection.
Defragments a collection and rebuilds the indexes.
Rebuilds all indexes on a collection.
Internal command that scans for a collection's data and indexes for correctness.
Performs a geospatial query that uses MongoDB's haystack index functionality.
Internal command that validates index on shard key.
Changes the minimum number of data-bearing members (i.e commit quorum), including the primary, that must vote to commit an in-progress index build before the primary marks those indexes as ready.
Name
Description
Selects geometries within a bounding GeoJSON geometry. The 2dsphere and 2d indexes support $geoWithin.
Selects geometries that intersect with a GeoJSON geometry. The 2dsphere index supports $geoIntersects.
Returns geospatial objects in proximity to a point. Requires a geospatial index. The 2dsphere and 2d indexes support $near.
Returns geospatial objects in proximity to a point on a sphere. Requires a geospatial index. The 2dsphere and 2d indexes support $nearSphere.
Name
Description
Forces MongoDB to report on query execution plans. See explain().
Forces MongoDB to use a specific index. See hint()
Specifies an exclusive upper limit for the index to use in a query. See max().
Specifies an inclusive lower limit for the index to use in a query. See min().
Forces the cursor to only return fields included in the index.
Give Feedback
© 2021 MongoDB, Inc.

About

  • Careers
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2021 MongoDB, Inc.