Back

How can i get two different values on the same attribute on a Query.equal

  • 0
  • Databases
ianmont
27 Oct, 2023, 23:45

I have this code (also attached image): const getAllUserOrders = databases.listDocuments(process.env.DB, process.env.DB_ORDERS, [ Query.equal("userId", userId), Query.equal("status", "active") ])

And i want the Query.equal to retrive either "active" or "expired"

How can i achive this?

TL;DR
The user wants to know how to retrieve both "active" and "expired" values using the Query.equal function in a database query. They have provided a code snippet where they currently only use the "active" value. A possible solution is to pass an array with both values to the Query.equal function. Example: `Query.equal("status", ["active", "expired"])`
Ryan
27 Oct, 2023, 23:54

You'd do Query.equal("status", ["active", "expired"]), arrays can be used to specify multiple values in some queries

ianmont
28 Oct, 2023, 00:41

thanks I'll try that

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