Back

why when i apply select to my query it gives me 500 internal error.

  • 0
  • Databases
  • Web
  • Cloud
Rovar2000
12 Dec, 2023, 07:15
TypeScript

this is the query i apply to it:

TypeScript
private filterQuery(query: string[], options?: GenericListOptions): string[] {
    query = [
      Query.orderDesc(options?.sortField || "$createdAt"),
      Query.limit(options?.limit || 15),
      Query.isNull("deletedAt"),
      Query.select([
        "$id",
        "status",
        "totalAmount",
        "userId",
        "items",
        "address",
        "$createdAt",
        "$updatedAt",
        "deletedAt",
      ]),
    ];
    if (options?.status && options?.status != -2) {
      query.push(Query.equal("status", options?.status));
    }
    if (options?.from && options?.to) {
      query.push(Query.between("$createdAt", options?.from, options?.to));
    }
    return query;
  }
TL;DR
The user is experiencing a 500 internal server error when applying a SELECT to their query. The error message suggests that queries on relationships are not supported. The user asks if one of the attributes is a relationship attribute. Solution: The issue seems to be related to the usage of relationships in the query. It is suggested to check if any of the attributes being selected ("items" or "address") are relationship attributes. If they are, try removing them from the SELECT statement and see if the error persists.
Drake
12 Dec, 2023, 18:39

are one of those attributes a relationship attribute?

Rovar2000
13 Dec, 2023, 05:27

yeah address and items are relational

Drake
13 Dec, 2023, 05:27

Queries on relationships are not supported

Rovar2000
13 Dec, 2023, 05:30

thanks, so i guess i just have to put ItemIds and addressId As their Attribute to exclude Items And Address.

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