-
Type:
Bug
-
Resolution: Done
-
Priority:
Minor - P4
-
None
-
Affects Version/s: 2.6.7
-
Component/s: Index Maintenance
-
None
-
ALL
-
-
None
-
0
-
None
-
None
-
None
-
None
-
None
-
None
I have "users" collection with these fields:
dob - ISODate
sex - Int
l - geoJSON
I want index for all the fields.
http://docs.mongodb.org/manual/tutorial/build-a-2dsphere-index/
From docs I see, that: "Unlike the 2d index, a compound 2dsphere index does not require the location field to be the first field indexed."
So, it means I can create indexes different ways
Works in queries:
db.users.ensureIndex({'l':'2dsphere', sex:1, dob:1})
Works in queries:
db.users.ensureIndex({sex:1, 'l':'2dsphere', dob:1})
In this case index will not be used in queries
db.users.ensureIndex({sex:1, dob:1, 'l':'2dsphere'})
Not sure if this is bug. But if not then it makes sense to change docs and inform
developers that location field must be first or second field in index.