PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, November 2, 2022

[FIXED] How do I find a value in Firestore without limiting myself to specific collection?

 November 02, 2022     firebase, firebase-authentication, google-cloud-firestore, ios, swift     No comments   

Issue

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?


Solution

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.



Answered By - Frank van Puffelen
Answer Checked By - David Goodson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing