I have an application for reading and annotating texts and wonder how best to structure the underlying Firestore database.
The application itself is a relatively simple ReactJS SPA running inside the browser. All users can independently upload text documents into the system and then annotate these documents in the user interface. To annotate, the user opens the document, clicks on a word and then enters some metadata about that word in a pop-up window. The system then highlights every occurrence of that word in all documents of that user, with a different colour depending on the metadata provided.
My original plan was to create 2 independent collections:
- A collection /documents, which will contain one Firestore document for each text document uploaded by the user. We expect to have an average of 200 text documents per user, each with up to 200kb of data and referencing up to 1.000 annotated words.
- A collection /words, which will contain one Firestore document for each word annotated by the user. We expect to have an average of 30.000 annotations per user, each with around 500 bytes of data.
I am now somewhat concerned that such a database scheme would entail relatively high operational costs, since the relevant annotations would have to be loaded from the database each time a text document is being displayed (and the Firestore Blaze plan would bill me 0.06$ for each 100.000 reads).
Is there perhaps a better (more cost-effective) way to structure this database?