Skip to content
This repository has been archived by the owner on Mar 2, 2021. It is now read-only.

Counting amount of tracks without fetching all #62

Open
oskarrough opened this issue Jan 1, 2020 · 1 comment
Open

Counting amount of tracks without fetching all #62

oskarrough opened this issue Jan 1, 2020 · 1 comment

Comments

@oskarrough
Copy link
Member

In emberfire v2 (the version we're using) you can count the amount of tracks in a channel by checking the length of the ids in channels.tracks without fetching all tracks.

This is not possible in v3, see FirebaseExtended/emberfire#587.

If you're not using Emberfire, which is more and more likely, you can fetch a channel and count the tracks.length yourself. But having a number property like tracksCount would be very useful.

To do this we'll need to implement a Firebase cloud function. Copy/pasta from here https://github.com/firebase/functions-samples/tree/master/child-count

@hugurp should we do this? I'm not a huge fan of maintaining an extra cloud function, however small it is. On the other side, I want to be able to count tracks easily without fetching all tracks across our applications.

@oskarrough
Copy link
Member Author

Having this properly would also help internet4000/radio4000#354 forward, since we can replace all the totalTracks stuff inside Radio4000.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant