sidferreira / aor-firebase-client

Firebase client for Admin on Rest
MIT License
57 stars 29 forks source link

Fetch Data from database on demand #9

Closed Hosnidokht closed 6 years ago

Hosnidokht commented 7 years ago

Now, all data is fetched to the client and then all operations like filtering apply to these data in the client side. This approach is not ideal for huge data.

sidferreira commented 7 years ago

@Hosnidokht Yes, this is a known issue. But at the same time it's kinda complex have a good silver bullet on that. If you have suggestions on how to implement it, be welcome to suggest!

sidferreira commented 7 years ago

@grahamlyus @Hosnidokht I think we should have a delegate property, so the user can override some of the behaviors. We won't be able to make a silver bullet in this case.

grahamlyus commented 7 years ago

@sidferreira @Hosnidokht

I imagine it could get quite tricky to handle this internally in an elegant manner.

I'm not a firebase expert, but filtering/searching is not it's strong point (especially text) and the best way to do it tends to be very dependent on each individual database.

I don't have scaling issues as I don't have huge data yet (I'm only using firebase in small side projects, not my day job). Before I found this project I was using js-data and it's firebase plugin, but that also filters, sorts, and paginates everything client side. I hope firebase addresses this before I have this problem ;)

Maybe some kind of "ref decorator callback" property could work that would receive the ref that would allow the client to call equalTo, etc. before returning. I think it would have to receive the aor filter, pagination, and sort params to be useful and would be reloading data upon each params change in GET_LIST, GET_MANY, GET_MANY_REFERENCE.

eyalabadi98 commented 6 years ago

This is something i'd definitely love to see. I would love to try and help you tackle this problem! this would definitely add a lot of functionality to this package!

sidferreira commented 6 years ago

AFAIK it is a Firebase limitation.

dobryanskyy commented 6 years ago

so, do I get it correctly - this is a "won't fix"? Because for bigger collections(like log items, etc) - downloading entire collection is really not an option.

sidferreira commented 6 years ago

@dobryanskyy yup Maybe you can use REST instead

dobryanskyy commented 6 years ago

I see, thanks