[SERVER-16144] geoSpatial search returns error 16885 if collection has no document with specified location field Created: 14/Nov/14  Updated: 14/Nov/14  Resolved: 14/Nov/14

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

Type: Bug Priority: Major - P3
Reporter: Alexey Lischinsky Assignee: Ramon Fernandez Marina
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Steps To Reproduce:

2dsphere index defined on some filed ( "loc" ):

       {
               "v" : 1,
               "key" : {
                       "loc" : "2dsphere"
               },
               "name" : "loc_2dsphere",
               "ns" : "mydb.mycoll",
               "2dsphereIndexVersion" : 2
       }

collection has many documents but none of them has loc
run find():

db.mycoll.find( { loc : { $near : { $geometry : { type : "Point" , coordinates : [ 100.0, 100.0 ] } } } } )

Participants:

 Description   

2dSphere index is built on the "loc" field. If collection has number of documents but none of the documents has the "loc" field, the geospatial find() against this collection will return $err 16885 : $near requires a point given.

Expected result empty cursor.

Non geospatial searches on non existing fields return empty cursors.



 Comments   
Comment by Alexey Lischinsky [ 14/Nov/14 ]

Confirmed/Resolved. Thank you for your help!

On Fri, Nov 14, 2014 at 1:13 PM, Ramon Fernandez (JIRA) <jira@mongodb.org>

Comment by Ramon Fernandez Marina [ 14/Nov/14 ]

lalexl, valid values for latitude are between -90 and 90; 100.0 is out of range. Please see this page for further information.

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