Let\'s say I have a bunch of posts (for a feed, like a Twitter/Facebook/foursquare feed) in MongoDB, and each post has a location & a timestamp.
What\'s the best
I suppose you ultimately end up with a list of posts that have two discrete ranking dimensions, i.e.:
{ age: 86400, distance: 1000 }
{ age: 172800, distance: 5000 }
{ age: 57600, distance: 20000 }
{ age: 288000, distance: 8000 }
Doesn't really matter what the units are, lets say seconds and metres. If you want both to affect the sorting rank then you end up with a ranking algorithm, at its simplest something like this:
rank = (C1 * age) + (C2 * distance)
Where C1 and C2 are constants you can tweak to tune the weightings. The values will depend what units you're using, and how much ranking influence you assign to each dimension.
Another option could be ordering first by a time aggregate then distance, so all posts from today ordered by distance; followed by yesterday's ordered by distance, and so on. Or vice-versa, ordering by a distance range, then age, so all within (0 - 1000m) ordered by age; followed by all within (1001 - 2000m), and so on.