GeoJSON $near in GraphQL query

Hi,

I like to find a way to use graphql geospatial query.

location: {
      type: "Point",
      coordinates: [-73.856077, 40.848447]
}

in mongo:

db.places.find(
   {
     location:
       { $near :
          {
            $geometry: { type: "Point",  coordinates: [ -73.9667, 40.78 ] },
            $minDistance: 1000,
            $maxDistance: 5000
          }
       }
   }
)

Please let me how to do in new GraphQL

Thank you

Radovan

1 Like

Hi @Radovan_Stas,

I think the best way to do it is by building a custom resolver function which will receive all input and run the $near query and return the results.

Best
Pavel