0

I'm using Firebase Realtime Database with Swift and I'm trying to get all the "titles" of JSON structures. For example, all the dates under "ordini" in the image below as a string, but not the content.

image

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
  • I know there's a (good) answer but wanted to add that what you are asking about are the child *keys* and while the answer is correct, you can still use .childAdded (for example) to iterate over those nodes and read each snapshot.key to get those dates and just don't use the rest of the read in data contained in the snapshot. – Jay Apr 18 '18 at 18:59

1 Answers1

1

What you're describing is called a "shallow query". This isn't supported with Firebase client SDKs. When you listen/observe a location in the database, you will always retrieve all of the data at that location. There is no way to restrict the query to just the immediate child keys.

If you want to be able to query for just those child keys, you'll have to duplicate the data at another location and query that instead. Duplication of data to satisfy specific queries is common on NoSQL type databases.

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