BuildShipBBuildShip
Powered by
krapomusicK
BuildShip•14mo 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(),
}
{
  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 { Firestore, DocumentReference, Filter, Timestamp } from "@google-cloud/firestore";
import
Jump to solution
BuildShip banner
BuildShipJoin
Join founders, builders, devs using Low-code / No-code to create backend, APIs, scheduled Jobs, automation, AI workflows
7,971Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

Firestore Collection Query with multiple filter : "Value is not a valid query constraint ..."
Answer OverflowAAnswer Overflow / ❓・buildship-help
2y ago
Buildship: Firestore Collection Query error
certified dirtiboiCcertified dirtiboi / ❓・buildship-help
3y ago
Is there a simple "row changed" trigger for Firestore?
solSsol / ❓・buildship-help
13mo ago
Create document in a SUBcollection in Firestore
aledepiAaledepi / ❓・buildship-help
3y ago