firebase-kotlin-sdk icon indicating copy to clipboard operation
firebase-kotlin-sdk copied to clipboard

How can I query using Timestamp?

Open LucianBusuioc opened this issue 10 months ago • 0 comments
trafficstars

I am trying to get some documents from the firestore where a field is bigger that a Timestamp value but the query is empty.

What I tried with documents that have the serverTimestamp way in the past: This is working:

query = query
                .limit(5)

query = query
                .orderBy("serverTimestamp")
                .limit(5)

This is not working

  query = query
                .where("serverTimestamp", greaterThan = Timestamp(0, 0))
                .limit(5)

 query = query
                .where("serverTimestamp", lessThan = Timestamp.now())
                .limit(5)

 query = query
                .where("serverTimestamp", lessThan = Timestamp.ServerTimestamp)
                .limit(5)

 query = query
                .where("serverTimestamp", lessThan = Timestamp(1735288355, 0))
                .limit(5)
      



What am I doing wrong?

LucianBusuioc avatar Dec 27 '24 08:12 LucianBusuioc