Hey rethinkers!
i've got a query optimization question that i cant quite figure out. It deals with geoLocation and time. I've got a ton of events, that all have a startTime
, endTime
(indexed), and location
(indexed). If i want to get the events that are happening nearby by a certain location that haven't happend yet, i can do one of two ways:
- I can get and filter all the events that haven't happend yet based on the end time, then calculate the location of all those events and only return the ones with the specified radius.
- I can use the
getNearest()
command (which would return all the expired events) and then filter out the events that haven't happend yet. My one worry with this apporach is thatgetNearest()
specifies how many to return, but I essentially need all of them within the given radius so i don't miss any events that haven't happend yet.
Im just unsure how i can figure out the fastest/most effecient query for this.
The best option to me would seem to be to filter and get all events that haven't happend yet, then use getNearest() to take advatage of the indexes. But i can call a get nearest on a filtered set. Please help!?!?!