0

Pertaining to the video by Firebase below, I have the following question- I have not received a response on YouTube yet, and was wondering if anyone here knows of a possible solution.

https://www.youtube.com/watch?v=sKFLI5FOOHs

In General I want to be able to know how to query data for selected items, and not all data in a set.

Specific Question: Instead of pulling all entries in a child ref, how can we select specific entries (key & value) from the data in Firebase? I'm having bad luck nesting with orderByChild() & I believe would need the on value listener event he began to mention.

For Example (#2): SELECT Name from Users WHERE email = "alice@email.com" instead of SELECT * from Users WHERE email = "alice@email.com"

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
  • See https://stackoverflow.com/questions/44919532/fetch-particular-fields-from-firebase-database, https://stackoverflow.com/questions/52109485/retrieving-all-the-data-from-firebase-excluding-some-fields, https://stackoverflow.com/questions/39596678/nosql-data-structure-to-select-subset-of-fields-with-firebase-and-query, https://stackoverflow.com/questions/51079674/read-only-certain-fields-in-firebase – Frank van Puffelen Apr 15 '19 at 01:32

1 Answers1

1

This is not possible with the client SDKs. When you receive a node, you will get all of its children every time.

If you need to limit the amount of data from a query, you will have to split the parent node into separate nodes that contain only the data for a desired query. Sometimes people duplicate data into different nodes just to create special queryable nodes for a specific purpose. This is fairly common to do with NoSQL type databases, and it's called data denormalization.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441