Back

Query.greaterThan not working

  • 0
  • Self Hosted
  • Functions
Tommy Angelo
12 Jun, 2024, 09:17

I have the following listDocuments query in Dart server function:

TypeScript
await databases.listDocuments(
    databaseId: "game",
    collectionId: "airports",
    queries: [
      Query.offset(offset),
      Query.limit(limit),
      Query.greaterThan("runway_count", 0),
      Query.or([
        Query.equal("type", "small_airport"),
        Query.equal("type", "medium_airport"),
        Query.equal("type", "large_airport"),
      ]),
    ],
  )

Here, greaterThan query seems not working. It successfully filters airports by type, however also returns airports with runway_count == 0. runway_count is a required integer attribute for the collection. Do you have any idea what might be the reason for that to be ignored?

TL;DR
The developers are facing an issue where the `greaterThan` query for `runway_count` in a Dart server function is not working as expected, still returning airports with `runway_count == 0`. The issue seems to stem from improper usage of the `greaterThan` query. To resolve this, `Query.greaterThan("runway_count", 0)` should be replaced with `Query.greaterThan("runway_count", Value.fromInt(0))` to effectively filter out airports with a `runway_count` of 0.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more