0

I am building an e-commerce store on React hosted on Firebase. The products have a high number of variations. How do I create a Firestore collection of product catalogue with these variations? Based on the permutations of the product variations, I would end up with ~20,000 unique products, each of which should have a unique productID. The tutorial I am taking suggested creating a .js array first and writeBatch to create a Firestore collection, but this seems really unfeasible when I need to generate ~20,000 unique products based on the possible variations.

An example of the variations that one product could have:

  1. Colours: 9 different colours
  2. Size: Small, big
  3. Customisation A: Yes, No
  4. Customisation B: Yes, No
  5. Customisation C: Yes, No
  6. Customisation D: Yes, No
  7. If yes for customisation D, customisation E: Yes, No. If no for customisation D, customisation F: variation 1, 2 or 3.

How should I go about this? Appreciate any advice.

chu-js
  • 181
  • 7
  • Are you asking [what is the fastest way to write a lot of documents to Firestore?](https://stackoverflow.com/questions/58897274/what-is-the-fastest-way-to-write-a-lot-of-documents-to-firestore) – Frank van Puffelen Nov 17 '22 at 15:17

1 Answers1

0

You can use this fake data generation site : Mockaroo which lets you customize your fake data as per your needs and there is also an option of format the fake data as firebase firestore one.

After generating fake data and downloading it you can import JSON as a collection in your firestore db for that refer this docs for how to do this without code.

Rohit Kharche
  • 2,541
  • 1
  • 2
  • 13