I am in need to write a query that retrieves documents from the last hour, using the field “timestamp” on the document to compare, notice that this field is a date string in the form of: “2019-09-30T12:25:07.000Z”, I was thinking on doing something like so:
select * from `b_name` where .... and timestamp >= date_add_str(now_str(), -1, "hour"))
however this only gives from an hour ago from current time, ideally I would like to create a new date object, and strip down the minutes part, that way I can do direct date comparisons, something like this: "2019-09-30T12:00:00.000Z"
assuming the current time is “2019-09-30T12:00:07.707Z” now any document that happens to have a timestamp of “2019-09-30T12:00:07.707Z” or higher will be picked.
Maybe if there is a way to get the current minutes past the hour, one could leverage to do something like this:
date_add_str(now_str(), -(get_minutes_past_the_hour), "minute"))
Does anyone know what is the cleanest way to achieve this using N1QL?