I want to get data according to validity of some properties. There are two fields in one table - “validfrom” and “validto”. Now how to filter data accordingly using couchbaselite & swift
Just create a query with a variable now
, that matches documents where validFrom
≤ now
and now
≤ validTo
.
Then before running the query, set the value of now
to the current date/time (as a string in ISO-8601 format; there is a utility function to do this.)
2 Likes