Skip to content

Commit

Permalink
Create a 2d index for "SpatialPosition.coordinates"
Browse files Browse the repository at this point in the history
This fixes a regression introduced by bounding box queries.

See openchargemap#170 and related
  • Loading branch information
remuslazar committed Nov 10, 2021
1 parent d954ec1 commit c162fd7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion API/OCM.Net/OCM.API.Core/Util/CacheProviderMongoDB.cs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ public async Task<MirrorStatus> RefreshCachedPOI(int poiId)
protected void EnsureMongoDBIndexes()
{
var poiCollection = database.GetCollection<POIMongoDB>("poi");
poiCollection.CreateIndex(IndexKeys.GeoSpatialSpherical("SpatialPosition.coordinates")); // bounding box queries
poiCollection.CreateIndex(IndexKeys.GeoSpatial("SpatialPosition.coordinates")); // bounding box queries
poiCollection.CreateIndex(IndexKeys<POIMongoDB>.GeoSpatialSpherical(x => x.SpatialPosition)); // distance queries
poiCollection.CreateIndex(IndexKeys<POIMongoDB>.Descending(x => x.DateLastStatusUpdate));
poiCollection.CreateIndex(IndexKeys<POIMongoDB>.Descending(x => x.DateCreated));
Expand Down

0 comments on commit c162fd7

Please sign in to comment.