Back

Check multiple attributes at once in DB query

  • 0
  • Databases
  • Flutter
Ipsoka
18 Apr, 2023, 16:07

I know that I can OR values with

TypeScript
database.listDocuments(
  queries: [
      Query.equal("attribute", [value1, value2]),
  ]
)

And I know I can AND attributes like so

TypeScript
database.listDocuments(
  queries: [
      Query.equal("attribute1", [value1]),
      Query.equal("attribute2", [value2]),
  ]
)

Is there a way to also OR attributes? Something like

TypeScript
database.listDocuments(
  queries: [
      Query.equal(["attribute1", "attribute2"], value1),
  ]
)

Or am I forced to do this ine two seperate queries?

TL;DR
The user is asking if there is a way to check multiple attributes at once in a database query using Appwrite. Currently, Appwrite does not support passing an array in the field value. The user suggests starting a feature request on the Appwrite GitHub page. The user then provides examples of how to use `OR` and `AND` conditions separately. However, the user is asking if there is a way to `OR` attributes together in a single query. It is not possible to `OR` attributes together in Appwrite, so the user is forced to use two separate queries.
Binyamin
18 Apr, 2023, 16:10

As of now Appwrite don't support passing array in the field value

That's sounds like something that can benefit many peoples. You can start a feature request in Github https://github.com/appwrite/appwrite/issues

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