Let's say I am building an application where users can send emails. The emails are in one of three states/folders:
- Draft/Drafts
- Sending (waiting to be sent by the server)/Outbox
- Sent
Which of these approaches would be the most efficient (least resource intensive) and which one would be the preferred design in most use cases to store the emails in a Firestore database?
- There is an
emails
collection, inside of which aredrafts
,outbox
, andsent
sub-collections. As an email progresses through the three stages of progress the document is moved between each collection. - The same concept as approach 1 however, each of the three sub-collections are root collections rather than sub-collections of an
emails
collection. - There is an
emails
collection with all the documents from each state at the root of the collection. Each document has astatus
field/property which is set to eitherdraft
,sending
, orsent
.