In my Swift app, when signing up a user, the user is prompted to select a username. This username will then be stored in the Firebase realtime database like this: self.ref.child("users").child(user!.uid).setValue(["username": usernameResponse])
, where username response is the value entered by the user. This happens as part of the sign up method:
FIRAuth.auth()?.createUserWithEmail(email, password: passwordUltimate) { (user, error) in
// ... if error != nil {
I would like to verify if the username is available before setting its value. Is there some kind of query I could use to check that there are no duplicates?
Here is my database with some sample data (qwerty12345 is the uid):