Below is my database schema that stores a many-to-many relationship between a task and tag model. Google state that the maximum size that a document can be stored on Firestore is 1 MiB. If I continuously add tags to a task the document size would exceed that size limit.
Firestore-root
|
--- tasks (collection)
| |
| --- taskID (document)
| |
| --- title: "Go for a cycle"
| |
| --- completed: false
| |
| --- userID: "zaEh95kXJKapyVUqrPws58dyRIC3"
| |
| --- tagIDs: ["rWqTxB01TK9w8KRo2GHD"]
| |
| --- // Other task properties
|
--- tags (collection)
|
--- tagID (document)
|
--- title: "Health"
|
--- userID: "zaEh95kXJKapyVUqrPws58dyRIC3"
|
--- colour: "red"
|
--- // Other tag properties
A solution that I have found to work is to create a junction table, however every time I navigate to the detail view of a task I have to query the database to find those relationships which in return drives up billing costs. Can’t help but feel as though I am caught between a rock and a hard place.