[SERVER-9341] geoNear won't accept GeoJSON structure Created: 12/Apr/13  Updated: 11/Jul/16  Resolved: 01/Jul/13

Status: Closed
Project: Core Server
Component/s: Geo
Affects Version/s: 2.4.1
Fix Version/s: 2.5.1

Type: Bug Priority: Major - P3
Reporter: Víctor Penela Assignee: Daniel Pasette (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to DOCS-1661 make it clear which query format shou... Closed
Operating System: ALL
Participants:

 Description   

Simple geoNear query with a GeoJSON Point as near value.

db.runCommand({ geoNear : "retail" , near : { type : "Point" , coordinates :  [40.45500000000228 , -3.7269999999] } })

Response:

{
	"ns" : "test.retail",
	"errmsg" : "exception: geo values have to be numbers :: caused by :: { 0: \"Point\", 1: [ 40.45500000000228, -3.7269999999 ] }",
	"code" : 13026,
	"ok" : 0
}

Same query with legacy point structure:

db.runCommand({ geoNear : "retail" , near : [40.45500000000228 , -3.7269999999]})

Response:

{
	"ns" : "test.retail",
	"near" : "1001011111110001101100010110000111000010100110111000",
	"results" : [
...
}



 Comments   
Comment by auto [ 01/Jul/13 ]

Author:

{u'username': u'monkey101', u'name': u'Dan Pasette', u'email': u'dan@10gen.com'}

Message: SERVER-9341 make log message explicit about format accepted with 2d geoNear
Branch: master
https://github.com/mongodb/mongo/commit/a7079c5c7c901bae94306d764ee816d63bb9bf63

Comment by Daniel Pasette (Inactive) [ 28/Jun/13 ]

Added a doc ticket to clarify the type of query which should be used depends on the index type: DOCS-1661

Comment by hari.khalsa@10gen.com [ 02/May/13 ]

Really a docs ticket. Need to make it clearer that you can't use geojson with 2d index type. And/or error better.

Comment by Scott Hernandez (Inactive) [ 12/Apr/13 ]

Please include the indexes for this collection, and sample of the docs in the collection.

db.retail.getIndexes();
db.retail.find().limit(3).pretty();

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