Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-21024

remove maxDistance in geoNear response if result set is empty

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.2.0-rc0
    • Component/s: Geo
    • Query Integration

      On previous versions of the server, if the result set is empty from a geoNear command, avgDistance was NaN. The following is using 3.0.7:

      {
      	"results" : [ ],
      	"stats" : {
      		"nscanned" : 12,
      		"objectsLoaded" : 4,
      		"avgDistance" : NaN,
      		"maxDistance" : 0,
      		"time" : 0
      	},
      	"ok" : 1
      }
      

      On 3.2.0-rc0, avgDistance is missing:

      {
      	"waitedMS" : NumberLong(0),
      	"results" : [ ],
      	"stats" : {
      		"nscanned" : 10,
      		"objectsLoaded" : 4,
      		"maxDistance" : 0,
      		"time" : 1
      	},
      	"ok" : 1
      }
      

      It seems that this is a bug as maxDistance is included even though it's 0.

            Assignee:
            backlog-query-integration [DO NOT USE] Backlog - Query Integration
            Reporter:
            emily.stolfo Emily Stolfo
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: