|
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
|