leodinas-hao / mongoose-query-parser

Convert url query string to MongooseJs friendly query object including advanced filtering, sorting, population, string template, type casting and many more...
MIT License
68 stars 17 forks source link

geoNear Error parse #23

Open mitinoh opened 2 years ago

mitinoh commented 2 years ago

I'm trying to use geoNear aggregation like this:

filter={
  "$geoNear":{
    "near": {
      "type" : "Point",
      "coordinates" : [12.897594,12.897594]
     },
    "spherical" : false,
    "distanceField" : "calcDistance",
    "maxDistance" : 240,
    "distanceMultiplier" : 0.1
  }
}

but when parsed the filter loses the coordinates, this is the result:

{
  '$geoNear': {
    near: { type: 'Point', coordinates: [] },
    spherical: false,
    distanceField: 'calcDistance',
    maxDistance: 240,
    distanceMultiplier: 0.1
  }
}

how can i solve this?