Reputation: 157
Need Help in Following geoadd code
_ client.geoadd('drivers_locations', coordinates[0], coordinates[1], driverID ,new Date().toString());
Upvotes: 1
Views: 296
Reputation: 49962
While GEOADD
doesn't support this, you can store the date property in another key, e.g. something like this:
client.geoadd('drivers_locations', coordinates[0], coordinates[1], driverID);
client.hset('driver:' + id, 'date', ,ew Date().toString());
Upvotes: 0
Reputation: 169051
No, there is no time dimension available for GEOADD
.
Depending on what you're doing, you might be able to emulate this by bucketing time into various keys, like
const key = `drivers_locations_${Math.floor(+new Date() / 1000 / 60)`;
client.geoadd(key, lon, lat, driverID);
but then querying becomes more complicated.
Upvotes: 1