From the course: Unity: Working with Google Firebase

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Sorts and filters

Sorts and filters

From the course: Unity: Working with Google Firebase

Start my 1-month free trial

Sorts and filters

- Firebase has several built in methods for sorting and filtering data directly from your database. In a lot of cases this can really cutdown on the time you need to manually unpack large-nested data snapshots. Let's look at a practical example here on our player-board manager. Here we've called our router .players and we've added our child-added. I'm gunna comment this out and I'm gunna call a new router instance, router, players, and here I'm just going to type in order. Now here you can see you can order by child, value, key and priority. If you're interested in how each of these works and how the return data is ordered, you can find detailed explanations in the database docs under the retrieving data section. For now we're just going to keep it simple and use the order by child method. Here it's expecting a string and what it's looking for is the property you want to order by. So here we want level. Similarly if we wanted to filter our player data by let's say the first 10 players…

Contents