In my mongodb Collection I have a 2dsphere index
{ "ns" : "PanPanDB.posts", "key" : { "location_2dsphere" : "2dsphere" }, "name" : "location_2dsphere_2dsphere", "background" : true, "safe" : null, "unique" : false }
When I query on it I obtain the following error:
> db.posts.find( { "location_2dsphere" :{ $near : {$geometry: { type : "Point" , coordinates : [ 100 , 5 ] } , $maxDistance : 1000}}} )
error: {
"$err" : "can't find special index: 2d for: { location_2dsphere: { $near: { $geometry: { type: \"Point\", coordinates: { 0: 100.0, 1: 5.0 } }, $maxDistance: 1000.0 } } }"
}
Can you help me? There isn't much documentation on the web!