Try to see if this guide can help you,
It’s not exactly the same thing you’re asking, but there are some concepts that could be useful to you.
you can do it, but it’s not very efficient because you would end up making 500 requests to the database, and it would make more sense to make a single one with 500 elements.
Firebase Database quotas are very high on the free plan, but if your app were to be used by many people, you could reach the limits.