Is there any way to get a user name by providing an ID from the client? Or is this only avaliable via the server sdk?
Like searching for a user by ID? You can't do it in the client side out of the box.
But, a good workaround will be:
- <:databases:1108648029243838465> Create a collection, and give it permission of
any.read
and add these attributes
- user_id
- user_name
- For all existing users, you can run some function in your local machine that will iterate over all of them and will add them to the newly created collection.
- <:functions:1108648038156746792> From now on, you can create a function and set it to be triggered on the event
users.*.create
that will be fired any time a new user is created. Then, you can add the newly created user to the collection.
Thanks!!
<a:agooglethumbsup:635256484682530825>
I really like the approach above 😇 Apps usually call this "onboarding" process. In my apps I personally dont put userID into collection, instead, save ID of profiles document on user preferences. Clients usually dont care about user ID of a profile anyway, and it adds extra complexity if yoy want to store this user ID reliably.
Or create a function wich call GET.user via API keys based on params ?
That's also a good idea. The logic behind keep it on the database aspect instead of function, its performance wise.
As if you can have the data in a public collection then each time you're requesting the information you going to do only one request. compere to function that you'll need to do two each request.
User Name [Solved]
[SOLVED] User Name
Recommended threads
- Query Appwrite
Hello, I have a question regarding Queries in Appwrite. If I have a string "YYYY-MM", how can I query the $createdAt column to match this filter?
- Different appwrite IDs are getting expos...
File_URL_FORMAT= https://cloud.appwrite.io/v1/storage/buckets/[BUCKET_ID]/files/[FILE_ID]/preview?project=[PROJECT_ID] I'm trying to access files in my web app...
- Invalid document structure: missing requ...
I just pick up my code that's working a week ago, and now I got this error: ``` code: 400, type: 'document_invalid_structure', response: { message: 'Inv...