[SERVER-12942] Multiple geoSpatial indexes in a collection Created: 27/Feb/14  Updated: 10/Dec/14  Resolved: 27/Feb/14

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 2.6.0-rc0
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Rajesh Khot Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: 2dsphere,, geospatial
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-3653 Issues with multiple spatial indexes Closed
Operating System: ALL
Steps To Reproduce:

db.testgeo.insert({name: "New York, NY", loc : { type:"Point", coordinates:[-74.005973,40.714353]}})
db.testgeo.insert({name: "Los Angles, CA", loc : { type:"Point", coordinates:[-118.243685,34.052234]}})
db.testgeo.ensureIndex(

{loc:"2dsphere"}

)
db.testgeo.ensureIndex(

{loc:"2dsphere",name:1}

)
db.testgeo.ensureIndex(

{name:1,loc:"2dsphere"}

)
db.testgeo.find({loc:{$near:{$geometry:{type : "Point" ,coordinates :[-74.005973,40.714353]}}}})

db.runCommand({geoNear: "testgeo",near : {$geometry:

{type : "Point" ,coordinates :[-74.005973,40.714353]}

}})
db.testgeo.aggregate([{$geoNear:{near:[-74.005973, 40.714353 ],distanceField:"dyst"}}])

Participants:

 Description   

The documentation at http://docs.mongodb.org/master/core/2dsphere/ states that you can have only one geospatial index per collection. However we can create multiple geospatial indexes

find with $near works

geoNear and $geoNear do not work
"errmsg" : "exception: geoNear command failed:

{ ok: 0.0, errmsg: \"more than one 2dsphere index, not sure which to run geoNear on\" }

"



 Comments   
Comment by Daniel Pasette (Inactive) [ 27/Feb/14 ]

Thanks for the report. It is a dupe of SERVER-3653.

Generated at Thu Feb 08 03:30:08 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.