Back

[SOLVED] Database error: "Invalid query: Attribute not found in schema:

  • 0
  • Databases
Matej
30 Sep, 2023, 13:59

iI have this query

TypeScript
    const result = await databases.listDocuments(config.databaseId, config.collectionId, [
      Query.select(['url', 'shortUrl, shortUrlFull']),
      Query.offset(0),
      Query.limit(1),
      Query.equal("shortUrl", [shortUrl])
    ]);****

And from my understanding, this is requal to "SELECT url, shortUrl, shortUrlFull FROM SOME_COLLECTION WHERW shortUrl = SOME_URL"

I am getting an error while executing this that Attribute is not found in schema.

If I would remove url and shortUrlFull from this select it would most likelly work, but I need all of that.

Anything wrong in my queries here?

TL;DR
Title: [SOLVED] Database error: "Invalid query: Attribute not found in schema:; Message: You have a typo in your select query - "shortUrl, shortUrlFull" should be "shortUrl", "shortUrlFull". Also, make sure "url" is not in quotes. Update your query to: ``` const result = await databases.listDocuments(config.databaseId, config.collectionId, [ Query.select(["url", "shortUrl", "shortUrlFull"]), Query.offset(0), Query.limit(1), Query.equal("shortUrl", [shortUrl]) ]); ``` This
safwan
30 Sep, 2023, 14:05

well in your select query, it seems like url is in quotes, and shortUrl, shortUrlFull are in the same quotes

safwan
30 Sep, 2023, 14:06

why not have two separate queries?

Matej
30 Sep, 2023, 14:06

ah crap

Matej
30 Sep, 2023, 14:06

I didn't see that typo

Matej
30 Sep, 2023, 14:06

Ty

Matej
30 Sep, 2023, 14:07

[SOLVED] Database error: "Invalid query: Attribute not found in schema:

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