-
Type: Bug
-
Resolution: Works as Designed
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.4.9
-
Component/s: Index Maintenance
-
None
-
ALL
I've created a compound index:
db.lightningStrikes.createIndex({ datetime: -1, location: "2dsphere" })
But when I run the query below the MongoDB doesn't consider the index, making a COLLSCAN.
db.lightningStrikes.find({ datetime: { $gte: new Date('2017-10-15T00:00:00Z') } }).explain(true).executionStats
Ps. When I create a compound index by datetime and another type of field it works (searching by index), as below:
db.lightningStrikes.createIndex({ datetime: -1, source: 1 })
I've seen in the documentation and I haven't found any reason for it.
https://docs.mongodb.com/manual/core/2dsphere/#create-a-compound-index-with-2dsphere-index-key
- related to
-
SERVER-9257 2dsphere compound index cannot be used non-geo search
- Closed