
help me fix it as i'm trying to get specifc last document of specific user... maybe it's wrong direction
response = await database.list_documents(database_id, collection_id, [ Query.equal("$permissions.read", [f"user:{user_id}"]),Query.limit(1), Query.order_desc('$createdAt')])
Got - Error getting the latest document: Invalid query: Attribute not found in schema: $permissions ....

Uh ya, you can't query on permissions like that

how can i? if i have collection that serve several users- isn't it the best way to filter on the server side per user?

The walkaround i did is to add attribute of the user_id for the collection, which looks to me pretty ugly practice

Sure but you can't do a query that isn't supported...

Yes, that is one approach. Otherwise, I often use the user id for the document id

So to put a prefix in the document id that is the userid? and then how to query that?

No use it as the document id.
For example, I have one app where I have a collection of user documents. Each user should have 1 document. So, I use the user's id for that document id when I create the document in the users collection. Then, when I need to fetch the user's document, I use the get document call

but if i got more?

you suggest to store all the "documents" in one document? the problem is that there is limit on that array document

I think it is a feature suggestion to add the query for permission, that will make the life much easier. Don't you think?

So a user will have multiple? Will they have access to others?

Feel free to add a 👍 to https://github.com/appwrite/appwrite/issues/5169

No - they don't have permission - it's document level permission

The real usecase happenning is when the server is adding data to users..and not the users themselfs..

Ya having an attribute for the user id is probably the best approach
Recommended threads
- Updating console to 1.8
Hey! Does anyone know how to update the appwrite console only? I am using console 1.7.4 but it has UI/UX issues 🙁
- Adding "name" column to table creates 2-...
As stated, im adding the "name" column to one table, it adds 4 duplicates. In another table it adds 3 duplicates, and when I delete 1 of them, all duplucates di...
- Having errors migrating to cloud
Project will not migrate compeltely
