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
- Function issue
Hi,idk whats wrong with my function but i made some changes to the env var and made sure they saved then i redeployed it,but then after it redeeployed it asked ...
- Can't resume paused project
I have logged in in incognito, done the email verification and still get the invalid fingerprint error. What's the issue.
- Weird permission failure
when creating an account I use following methods: ``` Future<void> register(String email, String password, String username) async { final user = await accoun...