Back

Facing this query error

  • 0
  • Web
π™π˜Όπ™‡π™‡π™€π™‰π˜Ύπ˜Όπ™‹
6 Jul, 2023, 16:51

here is the code

TL;DR
The user is facing a query error while fetching data for a profile using an API call. They found a problem and logged the user id before making the call. The problem seems to be with the filter, as the API call is successful but no results are being returned. It is suggested to check if the filter matches any data or if there is a permissions issue. It is also recommended to create an index as mentioned in the error message. The user should refer to the provided link for more information on creating indexes.
π™π˜Όπ™‡π™‡π™€π™‰π˜Ύπ˜Όπ™‹
6 Jul, 2023, 16:51
π™π˜Όπ™‡π™‡π™€π™‰π˜Ύπ˜Όπ™‹
6 Jul, 2023, 16:51
π™π˜Όπ™‡π™‡π™€π™‰π˜Ύπ˜Όπ™‹
6 Jul, 2023, 16:52

and here is the collection and attributes

Drake
6 Jul, 2023, 16:53

As the error says, you need to create an index. See https://appwrite.io/docs/databases#indexes

π™π˜Όπ™‡π™‡π™€π™‰π˜Ύπ˜Όπ™‹
6 Jul, 2023, 16:56

so what I have to modify???

Drake
6 Jul, 2023, 16:57

Did you read what I linked?

π™π˜Όπ™‡π™‡π™€π™‰π˜Ύπ˜Όπ™‹
6 Jul, 2023, 17:01

yes but the items are not rendering

π™π˜Όπ™‡π™‡π™€π™‰π˜Ύπ˜Όπ™‹
6 Jul, 2023, 17:03
Drake
6 Jul, 2023, 17:03

What do you mean?

Drake
6 Jul, 2023, 17:03

Don't use full text...

π™π˜Όπ™‡π™‡π™€π™‰π˜Ύπ˜Όπ™‹
6 Jul, 2023, 17:04

then???

Drake
6 Jul, 2023, 21:09

did you figure it out?

π™π˜Όπ™‡π™‡π™€π™‰π˜Ύπ˜Όπ™‹
7 Jul, 2023, 12:45

yes but the items aren't loading

Drake
7 Jul, 2023, 15:41

If the API call is successful, but you're getting 0 results back, either nothing matches your filter or you have a permissions problem

π™π˜Όπ™‡π™‡π™€π™‰π˜Ύπ˜Όπ™‹
7 Jul, 2023, 17:39

without filter its working perfectly

Drake
7 Jul, 2023, 17:51

What's your code?

π™π˜Όπ™‡π™‡π™€π™‰π˜Ύπ˜Όπ™‹
7 Jul, 2023, 18:21

this is

Drake
7 Jul, 2023, 18:21

Would you please log the user id before making the API call?

π™π˜Όπ™‡π™‡π™€π™‰π˜Ύπ˜Όπ™‹
7 Jul, 2023, 18:22

yes

π™π˜Όπ™‡π™‡π™€π™‰π˜Ύπ˜Όπ™‹
7 Jul, 2023, 18:22

and its printing

Drake
7 Jul, 2023, 18:23

Would you please share the value and a screenshot of the document from the console (showing the same user id)?

π™π˜Όπ™‡π™‡π™€π™‰π˜Ύπ˜Όπ™‹
7 Jul, 2023, 18:35

wait I think I found the problem

π™π˜Όπ™‡π™‡π™€π™‰π˜Ύπ˜Όπ™‹
7 Jul, 2023, 18:58

Now its working fine

π™π˜Όπ™‡π™‡π™€π™‰π˜Ύπ˜Όπ™‹
7 Jul, 2023, 19:02

I just Make another useContext file and take the user id when I also fetching data of account for profile and pass it on the query.

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