[SERVER-80402] Support creating a geospatial index on an array field of GeoJSON Points Created: 24/Aug/23  Updated: 21/Sep/23

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: Jonathan Lee Assignee: Katya Kamenieva
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
Related
Assigned Teams:
Query Execution
Participants:

 Description   

If you have a document containing an array field of geopoints, such as:

{
    _id: ObjectId("64e3e7f2ab7c883c6dc7e844"),
    locations: [
      { type: 'Point', coordinates: [ 1.23, 4.56 ] },
      { type: 'Point', coordinates: [ 1.23, 4.32 ] }
    ],
    name: 'hello'
}

Then trying to create an index on the array field fails with an error like:

> db.points.createIndex({ locations: "2dsphere" })MongoServerError: Index build failed: ab490695-9294-4389-a26e-649092d06c13: Collection geo.points ( 45b925d5-29ae-4d01-9073-039c9ae572ae ) :: caused by :: Can't extract geo keys: { _id: ObjectId('64e3e7f2ab7c883c6dc7e844'), locations: [ { type: "Point", coordinates: [ 1.23, 4.56 ] }, { type: "Point", coordinates: [ 1.23, 4.32 ] } ], name: "hello" }  Point must only contain numeric elements 

If there isn't a technical limitation in supporting this and it wouldn't be a huge lift, i think it would be nice to support this – otherwise, the documentation should probably state somewhere that this is explicitly unsupported

 

 



 Comments   
Comment by Katya Kamenieva [ 01/Sep/23 ]

jonathan.lee@mongodb.com can you add more details for how are you looking to query an array of points

Generated at Thu Feb 08 06:43:26 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.