Currently, I am a using a $nearSphere mongo query to fetch documents to fetch based on a given latitude, longitude, and a radius.
Is there a possibility where I can use google maps API to fetch real-time data between two points and find the real-time shortest route distance instead of shortest sphere distance between two points.
For eg. I pass a position [lng, lat] to fetch all the documents i.e records from the mongo database using $nearSphere query and giving a radius as 5 km. It will cross check with other records and find the documents within 5 km relative to the position passed in the request. The distance between passed [lng, lat] in the query and that of the [lng, lat] present in the database records are sphere distance.
What I want to find is the real-time route distance like how it is shown in UBER app or between pickup and destination positions and not the sphere distance. Is this possible to write a code on the server side to achieve this case?