0

I am making a Venmo Clone. And was wondering if Firebase is able to get an user by email. I know I can get the current user information but I need to get some other user's information

my database is structured in the following way.

    kbudafinanzasaddclose
         users
             JehUMapzvigre8QYryxoK53DEsG3
                 availableBalance: "0"
                 bankAccountNumber: "1122334455"
                 birthday: "12/12/12"
                 email: "admin@admin.com"
                 name: "admin"
                 swift: "12121212"
                 userId: "JehUMapzvigre8QYryxoK53DEsG3"
                 username: "admin01"
             ...

What I want to do, is be able to increase the "available balance" of admin01, when the other person chooses to pay and types as the "destination" the email of admin01.

I have tried to fetch for the ID using the email and then using that to edit the value of the "available balance" but I am not able to find the UID only with the email.

Is this possible? if not what else could I do to increase the availableblance of the receiver when someone sends him/her money

1 Answers1

0

Since Firebase is no scheme, it is not possible to query specifically for users with email of _ . Instead, you need to either

1) Query ALL users and search for each user if email = _

2) Query through two jsons 

  a) Create a seperate json of emails pointing to user_id

  b) Then querying your users json with that user_id
Mocha
  • 2,035
  • 12
  • 29