Questions about `date-time` data type
leandrogehlen opened this issue · 8 comments
I have some questions regarding the date-time
data type:
- Is it possbile to apply Condition Operators?
- Is not possible create index with this data type. By default this type is indexed?
- How is the best approach to handle datetimes attributes? Should be to define as 'number'
When you have a field with format: "date-time"
, then the type
is still string
. So you can only store plain strings in RxDB. You can do whatever operators or indexing on that. If your date format is sortable, you can apply $gt and index it.
@pubkey, thanks for the answer.
It could be helpful to have a doc section for this topic
Yes good idea. I added it to the docs.
Please make a PR with a test case. But from your error it looks like you set type: "date-time"
which will not work.
I'm confusing... I understood that date-time
type supports index
If your date format is sortable, you can apply $gt and index it.
But still you need a valid json schema and cannot put date-time as type, only as "format".
I'm sorry, i did not pay attention about it.