Home > front end >  How do I find a value in Firestore without limiting myself to specific collection?
How do I find a value in Firestore without limiting myself to specific collection?

Time:11-01

I'm new to Firebase and Firestore and I just got involved in a Swift iOS project that uses Firebase as its backend. I normally use a Postgres database so I'm not very comfortable using NoSQL yet. I like SQL databases that have a defined schema so I can be sure that all entries have the same parameters.

But... it looks like Firestore is all NoSQL so I am trying to keep up as best as I can.

I have a user login/signup page that uses Firestore. I decided to test it by signing up, logging out, deleting the user from the Firestore console page in its relevant collection, and signing up again. The Firestore console page looks like this:
enter image description here

But when I delete the user and try to sign up again, I get an ERROR_EMAIL_ALREADY_IN_USE error.

I have no idea why the app is detecting that email address as still being in the database. Maybe the users are also being stored to a different collection that I'm not seeing?

Anyway I think it would be easier to delete every instance of this email address if I could search across all collections and all key values. Is there any way to do this?

CodePudding user response:

There is no way to search across all collections in Firestore. But you don't need that to get rid of this problem.

The ERROR_EMAIL_ALREADY_IN_USE comes from Firebase Authentication, not from Firestore. Firebase Authentication stores its user data in a database that you have no access to, aside from through the Firebase Authentication API.

What you'll need to do is call user.delete on the device where the user is signed in, delete them through the Firebase Admin SDK, or delete them from the Authentication panel in the Firebase console.

  • Related