0

I have a Firestore db where I have setup the structure: registrations/[userId]/symptoms/[documentId]/[some kind of document]

I did like this because the user should only read its own symptoms, and therefore I thought it would be good to separate the symptoms on userId. The document has no knowledge about the userId.

When I now export it to BigQuery I don't know how to get the correlation between a document and userId, maybe it is not possible.

Should I instead have it like: symptoms/[documentId]/[some kind of document with a userId]

And then only filter out the documents for the specific userId? What is the difference in the number of reads? I imagine that with my solution right now the user will only read the documents that is under /[userId]/, but with other solution every user has to read every document and then filter? Or is that handled by Firestore, and is not counted as a read?

Glorfindel
  • 2,205
  • 5
  • 19
  • 26
matsmats
  • 101

1 Answers1

-1

You should have a collection per object type, so it’s easier for you to keep track of what each collection contains.

Each document should have userId, security can be managed with Rules.

alibttb
  • 99
  • 3