Is Firestore a good database for storing many large objects in?

Viewed 94

I have been using React/Leaflet to create a choropleth map that can color any country on the map. What I am trying to do is to develop a save/load function that saves the colored countries and later be able to import it from the database. When this object is saved and loaded, it can bring back the exact same countries that were colored. I have been using firebase/firestore but I haven't been getting any luck.

This is how my object of map data looks like

Is Firestore the right database to do it? Or should I approach another database? I need a database that can store multiple objects in the picture above.

1 Answers

If you can convert that file into a JSON of a size smaller than 1MB, which is the Firestore Document size limit, it is possible. In the case you are proposing I would have the following structure, from the information you shared but fell free to adapt it as you see fit:

Map Collection
   field1
   ...
   fieldN
   CountriesOptions Subcollection
      optionObject: {}

Where each object is a separate document in the CountriesOptions subcollection converted to JSON using JSON.stringify(obj).

For more information on how to structure your Firestore with subcollections you can check this link to the documentation.

Related