RethinkDB: filtering by date (when the date is a string)

By John Keyes

May 3, 2024 at 16:34

rethinkdb

Dates represented by strings

In the Journey table the updated_at field is a date time represented by a string e.g. 2024-04-29T13:28:04+00:00.

To retrieve all records in a specific month we can use the less than (lt) and greater than (gt) operations.

For example:

  r.db("faceitdown")
    .table("Journey")
    .filter(
      r.row('updated_at')
        .gt("2024-02-01")
    )
    .filter(
      r.row('updated_at')
        .lt("2024-03-01")
    )

Last updated: May 3, 2024 at 16:34