There's an issue at hand.
We have a route with several bus stops.
We need to determine the next stop on this route.
The "_stopNum": "1" indicates that the stop is the first one on the route.
Take a look at a stop example:
{
"route": [
{
"_transport": "regionalbus",
"_num": "146",
"_direction": "b-a",
"_directionName": "Nõva - Harju-Risti - Padise - Ämari - Keila - Harku - Tallinn",
"_stopNum": "1"
}
],
"_id": "5701054-1",
"_id0": "134773",
"_name": "Laimi",
"_lat": "59.22155",
"_lon": "23.67992"
}
You can refer to the scheme I created here to better understand the problem.
Additionally, check out a snapshot of a portion of the array here.
I attempted to use the .find function but struggled to search for an object within an array of objects inside another object in an array of objects. Apologies for the confusion.