John Doe
John Doe

Reputation: 1609

Retrieve Specific Value In Firebase

I have a list of users in Firebase that looks like this...

enter image description here

How would I retrieve only the email (for example) values?

Upvotes: 0

Views: 640

Answers (1)

Jay
Jay

Reputation: 35657

THE answer.

Two things.

1) Please copy and paste your structure instead of a picture so we don't have to retype it. Please take a minute to format it so it looks cool.

2) This is a very basic query in Firebase and fully explained in the Most Excellent Guide to Retrieving Data In Firebase

Scroll down the query section and there are a couple of examples that are very similar to what you are asking for.

And a tad more info. Doing a query will retrieve each child node that matches the query (including the other stuff within the node). It's up to your code to grab each email (pretty simple task as it's key:value pairs)

If you don't want the other stuff, you would need to change the structure of the data

asdf
   firstName
   lastName
   etc

emails
   asdf
    email: email address
   asdf1
    email: email address

or, use events: value for example and a structure like this

emails
  asdf: email address
  asdf1: email address

Upvotes: 1

Related Questions