Too many keys in 2dsphere index when used on geoJson within arrays
Mongo support have asked me to raise this bug as an improvement idea because they see it as an edge case.
The issue is here and includes more details:
https://support.mongodb.com/case/00659614
In summary, if you have a geoJson sub document that sits within an array, and you index it using the 2dspehere index, you get keys duplicated for every element in the array.
For example, if you have geoJson that represents a big 4,500 vertex polygon, and you put it within an array element, if the array has only one element I see 20 keys generated, which is good. But if you have another element in the array that doesn’t have any geoJson, another 20 keys are generated, now totaling 40 keys for that document.
In our application this bug can cause the index memory requirements for 2dsphere to become a serious concern.
We have stopped using the index and developed an alternative.