how to fetch documents from one month old only firestore

前端 未结 1 580
夕颜
夕颜 2021-01-26 07:21

I\'m doing a query to fetch only 1 month old documents.

I store the creation time of the document itself

timestamp : 9 Apr, 2020 10:03:43 AM
相关标签:
1条回答
  • 2021-01-26 07:50

    Firestore does not offer timeboxed queries that restrict a range of documents based on the sense of server time. You will have to trust that the client is sending the correct time.

    The only control you have over time is using request.time in security rules. You could write a rule to allow queries that only fall within times based on the server timestamp, but it's still up to the client to specify the time correctly in the query. The rules will not be able to filter results based on time.

    You might want to read more about how server timestamps work with security rules at the end of this article.

    0 讨论(0)
提交回复
热议问题