krapomusicK
BuildShip13mo ago
12 replies
krapomusic

Simple filter by date in a Firestore query

Hey everyone,

I just started trying BuildShip and I'm already stuck on something that should be very easy, however I can't find the right documentation.

I made a Firebase collection query, I tested it without any filter and it does return the elements I expect. However I can't figure out the correct syntax of the filter to only return elements where "NextOccurence" property is before the current date and time.

{ field: "NextOccurence", operator: "<=", value: Date.now(), }

Can you help ?
Solution
@Chinmay Khandelwal Firestore does not directly support a "not equals" (!=) operator for queries, including those on timestamp fields. This is a limitation in Firestore's query capabilities

there is not issue with Date.now() - for the error firebase is not defined ensure the node has - import { Firestore, DocumentReference, Filter, Timestamp } from "@google-cloud/firestore"; import
Was this page helpful?