remove maxDistance in geoNear response if result set is empty

XMLWordPrintableJSON

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

      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:
              [DO NOT USE] Backlog - Query Integration
              Reporter:
              Emily Stolfo (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated: