$geoWithin 搜索应该使用哪个索引?

Which index should I use for $geoWithin searching?

我正在使用以下条件按位置查询文档

db.collection.find({
    "location": {
        "$geoWithin": {
            "$box": [
                [165.8694369, -52.61941849999999],
                [-175.831536, -29.2313419]
            ]
        }
    }
});

我应该为位置字段使用哪种索引类型 2d2dsphere

引用 documentation.

The query calculates distances using flat (planar) geometry.

Changed in version 2.2.3: Applications can use $box without having a geospatial index. However, geospatial indexes support much faster queries than the unindexed equivalents. Before 2.2.3, a geospatial index must exist on a field holding coordinates before using any of the geospatial query operators.

Only the 2d geospatial index supports $box.


Spherical

To calculate geometry over an Earth-like sphere, store your location data on a spherical surface and use 2dsphere index.

Store your location data as GeoJSON objects with this coordinate-axis order: longitude, latitude. The coordinate reference system for GeoJSON uses the WGS84 datum.


Flat

To calculate distances on a Euclidean plane, store your location data as legacy coordinate pairs and use a 2d index.