Back

[AppwriteException: Invalid query: Attribute not found in schema: MRP]

  • 1
  • Databases
  • Realtime
  • Cloud
Random Void
21 Dec, 2023, 08:27

Using AppWrite Cloud & Im facing issues when running Queries in collection. Actually,the queries is running perfectly fine in my old colelctions and I've tested all queries function on them but In New Collections,i am getting an error while querying even fetching & creating the data is working well on new collections but unable to do query

Like if I run query :: Query.equal('Name', 'Coca Cola')

getting an error :: ERROR Error fetching city data: [AppwriteException: Invalid query: Attribute not found in schema: Name]

While I've attribute named Name in my collection. Ive tested all queries function in these new collections but none of them is working.

TL;DR
User is facing an issue with querying in a new collection called PRDB. They have tried renaming the collection and recreating it, but the error persists. Fetching the whole data works fine, but running queries gives an error "Invalid query: Attribute not found in schema: Name". Another user suggests clearing the backend cache by renaming the database and collection. The user confirms that the steps result in an error. Another user is trying to reproduce the issue. Solution is not given in the thread.
Random Void
21 Dec, 2023, 08:30

See, fetching whole data is working well but unable to use Query in new collections...I've created 3 new collections and none of them is working fine with Query

D5
21 Dec, 2023, 08:55

The attribute name was created recently?

Random Void
21 Dec, 2023, 09:42

3 hours ago

Meldiron
21 Dec, 2023, 09:45

Hey 👋 Very weird, Ill try to reproduce it quickly on my end

Meldiron
21 Dec, 2023, 09:48
  1. Create database main
  2. Create collection profiles
  3. Add attribute Name, string length=255, required
  4. Add key index for Name attribute
  5. Add 2 documents with different names
  6. In settings give read permission to Any
  7. Send request with query

Seems to work fine on my end. Can you please confirm these steps result in error for you?

Meldiron
21 Dec, 2023, 09:49

Wild idea, it might be backend cache issue. To test that ,can you please try to rename your database and collection? Random name, save, then back to original name, save. That forces cache to cleared. If it starts working fine after that, we know it's issue on cache layer

Random Void
21 Dec, 2023, 10:22

1.In my database data-level-1 2.Created collection profiles 3.Added attribute Name 4.Added key index 5.Added 2 documents 6.Gave permission 7.Query is working fine [ getting expected result ]

***BUT *this I know and the same method I'm using on different collections as well & they're working well

See my colections https://discord.com/34943382-3675-4669-9e2f-5e4317adea49


I am facing Query issue in the collection PRDB Yes,I created another collection with same data but still error persists.

See,I've attached the PRDB collections.

Fetching whole data is working fine const databases = new Databases(client); const response = await databases.listDocuments('data-level-1', 'PRDB'); console.log(response);

But,with Query it is giving an error.

ERROR:: ERROR Error fetching city data: [AppwriteException: Invalid query: Attribute not found in schema: Name]

CODE ::

TypeScript
        const response = await databases.listDocuments('data-level-1', 'PRDB', 
       ** [Query.equal('Name','Coca Cola')]**
        );
        console.log(response);`
``
Random Void
21 Dec, 2023, 10:29

Also,getting an error on creating index in Name attribute

Meldiron
21 Dec, 2023, 10:31

Did you at any point delete collection, and created collection with same custom ID?

Random Void
21 Dec, 2023, 10:32

No

Random Void
21 Dec, 2023, 10:43

I'm unabe to figure out the main cause of this issue. What I tried till now? 1.Changed Collection Name 2.Re-Created the collection with same attributes / data

Drake
21 Dec, 2023, 17:13

recreating the collection should have solved things...so the problem now is failed index?

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