Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Price sub collection is really a good practice ? #628

Open
EArminjon opened this issue May 27, 2024 · 1 comment
Open

Price sub collection is really a good practice ? #628

EArminjon opened this issue May 27, 2024 · 1 comment

Comments

@EArminjon
Copy link

EArminjon commented May 27, 2024

Feature request

Price sub-collection should maybe not be a sub collection.

Is your feature request related to a problem? Please describe.

Use case : I've 1000 products in my stores and want to display them 20 by 20.

So I do a pagination system and fetch first 20 items with some filters and where conditions. As price are inside a sub-collection I should do 20 others reads to get prices.

Is this a good practice ? And also how to fetch and order by price / promotion?

I saw this issue #79 It was closed because "most SaaS offerings have less than five tiers (products) and rather want to be able to filter & sort prices, so I think the current sub-collection setup serves them well" and "... [price could] have lots of pricing options that will need to be filtered (like lots of currencies, perhaps),".

Feel like it's a bit light as technical justification, maybe they is a more technical reasons behind that and I would like to know more if possible.

With your knowledge today, is it still good practice to have this sub-collection ?

  • Having prices inside the main collection doesn't make above Saas example impossible and it simplify it and reduce read costs.
  • Having this change could help e-commerce apps.

Maybe I miss something, if so please explain :) !

Describe the solution you'd like

Merge price sub-collection into main collection.

Describe alternatives you've considered

Actually i fetch products and then fetch price. I'm little sad about the double reads.

Additional context

E-commerce apps.

@EArminjon EArminjon changed the title [Price inside main collection] Price sub collection is really a good practice ? [Prices] Price sub collection is really a good practice ? May 27, 2024
@EArminjon EArminjon changed the title [Prices] Price sub collection is really a good practice ? Price sub collection is really a good practice ? May 30, 2024
@DCSnip3r
Copy link

DCSnip3r commented Sep 2, 2024

This is a good format because it makes it more flexible if you ever want to make pricing changes. Often it's a good idea to fetch a product, then display all the ways to pay for it.

If it's not good in your situation, did you consider using a collectionGroup so you can query prices directly?

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

No branches or pull requests

2 participants