[SERVER-47052] MongoDb Geospatial query failure with a valid 2dsphere index via PHP Created: 18/Mar/20  Updated: 23/Mar/20  Resolved: 23/Mar/20

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

Type: Bug Priority: Major - P3
Reporter: Michael Mikhjian Assignee: Carl Champain (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

MongoDB 3.4.5
PHP 5.4.45
PHP/Mongo Driver 1.6.16


Participants:

 Description   

The query looks like this:
 

db.profiles.find({"geo":{'$near': {'$geometry':{"type": "Point","coordinates": [lng, lat]},'$maxDistance': 1609}}})

The data set looks like this:
 

{"_id" : ObjectId("59a48857db5398fbd494314e"),"geo" : {"type" : "MultiPoint","coordinates" : [[-122.1978901,47.61331250000001],[-122.7305319,45.4170443]]}}{"_id" : ObjectId("59a48881db5398fbd4946213"),"geo" : {"type" : "MultiPoint","coordinates" : [[-122.1968714,47.6124774],[-149.8850143,61.1872725],[-122.3312508,47.6064065]]}}

The index looks like this:

{"v" : 2,"key" : {"geo" : "2dsphere"},"name" : "geo_2dsphere","ns" : "xyz.profiles","2dsphereIndexVersion" : 3}

These are all JSON valid schema, the query is valid per the documentation and the data is being stored as MultiPoint to support the multiple coordinates.

However, the response when running the query is:
 

127.0.0.1:27017: error processing query: ns=xyz.profiles ntoreturn=500Tree: GEONEAR  field=geo maxdist=1609 isNearSphere=0Sort: {}Proj: {}planner returned error: unable to find index for $geoNear query"



 Comments   
Comment by Carl Champain (Inactive) [ 23/Mar/20 ]

Thank you mmikhjian@gmail.com. I will now close this issue.

Comment by Michael Mikhjian [ 23/Mar/20 ]

This may be closed, the issue was external. 

Comment by Michael Mikhjian [ 18/Mar/20 ]

Sorry this was assigned incorrectly, the project needs to be changed to Core Server.

Generated at Thu Feb 08 05:13:09 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.