tomOriginal post
Rank 1: Thread
What are some guiding principles to check whether or not a username is taken? I have a usersCollection, which stores various attributes about each user, including their username. When a new user joins our platform, I want to check if their username already exists in the collection. To do this, I need to return a list of all the username attributes for all the documents in my usersCollection, then check if the inputted username is in that list. I worry that means every user must be granted access to ever usersCollection document to construct that list in the first place.
Is this solved with a cloud function?
Summary
The developer wants to check if a username is taken by comparing it with the usernames in a usersCollection. They are wondering if granting access to all usersCollection documents is necessary in order to construct a list of usernames for comparison. They are also asking if this can be solved with a cloud function.
Solution: One possible solution is to use a cloud function to perform the check. Instead of granting access to all usersCollection documents, you can write a cloud function that queries the usersCollection and returns a list of usernames. Then, you can compare the inputted username with this list in the cloud function itself and return the result. This way,