Why does this always return, found even when it shouldn’t?

Im checking to see if the user exist in the db before allowing it to go further into the onboarding process. No matter what email I try it says email found, why? What am I missing or doing wrong?

func signUp(email: String, password: String) {
    let doesEmailExist = db.collection("users").document(email)
    doesEmailExist.getDocument { (document, error) in
        if let document = document {
            if document.exists {
                print("email found")
            } else {
                print("email is new")

Read more here: https://stackoverflow.com/questions/68474400/why-does-this-always-return-found-even-when-it-shouldnt

Content Attribution

This content was originally published by Jason Martinez at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: