
I am trying to query my collection Categories. Initially, I tried to query by the documentId, but that yielded no results. I then added an index on $id, that did not help... Now tried to Query on the name attribute... that didnt work either. Not sure what I am doing wrong... Here is the query. TIA
config.db, config.collection.categories, [ Query.equal("$id", ["68432b91003a62bcfab4"]) ] );
config.db, config.collection.categories, [ Query.equal("name", ["Emotional Health"]) ]

Could you provide the response of rhe function?

Also
If you are trying tk fetch a document with its id its better to use getDocument

I am getting an empty array ...

I can try that... not sure why I could not get by "name" either... not sure what I am doing wrong ...


printing categories to the console ...

appreciate your time and willingness to take a look. Thank you!

Could you go to website and select with the name? Like using filter in your collection?

New to app write... not sure what site you are talking about and where to select...

The appwrite website. The page where you see the collection documents

There in filters select the attribute(name) and then equal then put the same value

Querey by "name" works with the value entered ...

Could you provide the code?

Not really sure what is wrong here

try { const { documents, total } = await database.listDocuments( config.db, config.collection.categories, [ Query.equal("name", ["Emotional Health"]) ] ); setCategories(documents); console.log("CATEGORIES RESULT: " + categories); } catch (error) { console.log("ERROR:", error); setError(error); }

the collection has READ permissions for "Any"

That is not the problem. If it was related to this then it would return unauthorized error


Is listdocument without any query returning any document?

i will try

ok... couple of things ... first... not sure why console.log is not displaying anything...
Recommended threads
- Barcode scanner help
Hi guys! I want to integrate a barcode scanner for my nutrition tracking app for school. However, I think because of the most recent update and the newest SDK...
- Implement sorting (by $createdAt) while ...
??
- Function Event wildcards caused infinite...
Hi guys <@&1319717958645452800> I created a function to be triggered everytime an item is added or checked state changed in items collection it update the li...
