MongoDB Documentation, Release 3.0.4 Considerations geoNear and $geoNear Restrictions The geoNear command and the $geoNear pipeline stage require that a collection have at most only one 2dsphere index and/or only one 2d (page 497) index whereas geospatial query operators (e.g. $near and $geoWithin ) permit collections to have multiple geospatial indexes. The geospatial index restriction for the geoNear command and the $geoNear pipeline stage exists because neither the geoNear command nor the $geoNear pipeline stage syntax includes the location field. As such, index selection among multiple 2d indexes or 2dsphere indexes is ambiguous. No such restriction applies for geospatial query operators since these operators take a location field, eliminating the ambiguity. Shard Key Restrictions You cannot use a 2dsphere index as a shard key when sharding a collection. However, you can create and maintain a geospatial index on a sharded collection by using a different field as the shard key. 2dsphere Indexed Field Restrictions Fields with 2dsphere (page 496) indexes must hold geometry data in the form of coordinate pairs or GeoJSON data. If you attempt to insert a document with non-geometry data in a 2dsphere indexed field, or build a 2dsphere index on a collection where the indexed field has non-geometry data, the operation will fail. Create a 2dsphere Index To create a 2dsphere index, use the db.collection.createIndex() method, specifying the location field as the key and specify the string literal "2dsphere" as the index type: db.collection.createIndex( { <location field> : "2dsphere" } ) Unlike a compound 2d (page 497) index which can reference one location field and one other field, a compound (page 489) 2dsphere index can reference multiple location and non-location fields. For more information on creating 2dspshere indexes, see Create a 2dsphere Index (page 530). 2d Indexes Use a 2d index for data stored as points on a two-dimensional plane. The 2d index is intended for legacy coordinate pairs used in MongoDB 2.2 and earlier. Use a 2d index if: See the http://docs.mongodb.org/manual/reference/operator/query-geospatial for the query operators that support geospatial queries. Considerations The geoNear command and the $geoNear pipeline stage require that a collection have at most only one 2d index and/or only one 2dsphere index (page 496) whereas geospatial query operators (e.g. $near and $geoWithin ) permit collections to have multiple geospatial indexes. The geospatial index restriction for the geoNear command and the $geoNear pipeline stage exists because neither the geoNear command nor the $geoNear pipeline stage syntax includes the location field. As such, index selection among multiple 2d indexes or 2dsphere indexes is ambiguous. No such restriction applies for geospatial query operators since these operators take a location field, eliminating the ambiguity. Do not use a 2d index if your location data includes GeoJSON objects. To index on both legacy coordinate pairs and GeoJSON objects, use a 2dsphere (page 496) index. • your database has legacy location data from MongoDB 2.2 or earlier, and • you do not intend to store any location data as GeoJSON objects. 497 8.2. Index Concepts