I am new to FaunaDB and struggling with one query.
I would like to get documents that are within a certain date range.
I have documents that have start and end fields, these are timestamps.
The query could work with
max(user.start, document.start) <= min(user.end, document.end) but I am struggling to create the right query.
Document has Start 10 Oct 2020 and End 11 Oct 2020
User selects a range to search for:
Start 10 Oct 2020 End 10 Oct 2020 - returns the document
Start 9 Oct to 2020 End 10 Oct 2020 - returns the document
Start 9 Oct to 2020 End 12 Oct 2020 - returns the document
Start 10 Oct 2020 End 12 Oct 2020 - returns the document
Start 12 Oct 2020 End 14 Oct 2020 - does not return the document
Document can look like this:
Thanks a lot, I am open to any suggestions when it comes to structure, e.g. creating some helper tables if the above is not possible, etc.
FYI I have read similar discussion (Indexing on Dates, Conflict-Checking for Appointments - #3 by databrecht) but I am still lost.