0

I am implementing an express session with rethinkdb and I have an 'expires' field that is calculated as so: r.now() + 24 * 60 * 60 * 1000 (1 day from now).

Can I do something like this?

r.now().add(millisecondsToAdd)

There is no api documentations for this. It will also be useful for querying.

Note: I am using the official Javascript driver.

Joon
  • 9,346
  • 8
  • 48
  • 75

1 Answers1

1

You can do that

r.now().add(24*60 * 60 * 1000)

However, it's second, not millisecond. So to add one one more day, it is:

r.now().add(24*60*60)

When you browser the API, add saying about time: https://www.rethinkdb.com/api/ruby/add/

time.add(number[, number, ...]) → time

sub works similar to add btw.

kureikain
  • 2,304
  • 2
  • 14
  • 9