Find all restaurant whose location is within 10 meter of my polyline i.e LineString

5 views
Skip to first unread message

Rajat Goyal

unread,
Aug 31, 2019, 9:12:03 AM8/31/19
to mongodb-user
Hi Team,

I want to find all the restaurant whose location is within 10 meter of my polyline i.e. LineString. I have a restaurant Schema. Each restaurant has its own latitude and longitude as below.

{

   "locationLongLat" : {

        "type" : "Point", 

        "coordinates" : [

            -122.215, 

            37.771

        ]

    }

}

Now i am executing a mongodb query to find all restaurant that is near to my PolyLine but I am not getting any response. I am sharing my query over here.

db.restaurant.find({
$near: {
$geometry: {
type: 'LineString',
coordinates: [
[-122.214, 37.772],
[-157.821, 21.291],
[178.431, -18.142],
[153.027, -27.467]
]
}
}
})


Can you please help me out to find the exact query?

Reply all
Reply to author
Forward
0 new messages