LearnBoost/mongoose — Issue #610: Add $nearSphere to lib/schema/array.js { $conditionalHandlers }
Author: deremer
Created: 2011-11-11 18:24:59+00:00
State: open

I'm switching from $near to $nearSphere and if you swap it as part of the query you get an error that says "Can't use $nearSphere with Array." This is easily fixed so that results are returned by adding:

'$nearSphere': SchemaArray.prototype.castForQuery

to SchemaArray.prototype.$conditionalHandlers which begins on line 154. of array.js

I'm not sure if adding it here has other impacts on other areas of mongoose or if this is just a validation for mongo overall. However, $nearSphere and $centerSphere were added to mongodb in 1.7.0.

Thanks!