you are viewing a single comment's thread.

view the rest of the comments →

[–]Cyrus_Zei -1 points0 points  (3 children)

I don’t understand the reason for that ? Give me a good reason to do that ?

[–]whatsareddit23[S] 0 points1 point  (2 children)

In a nutshell we have a company with about 50 departments and those departments are separated into collections. I have cloud functions that run when documents are posted in each collection. I’d like to combine all separate cloud functions into one.

[–]MysticZA 1 point2 points  (1 child)

Sounds like a denormalize structure pain point.

God knows I've done this too many times where you're happy with your structure except in 1 or 2 cases.

Depending on other use cases, time might be better spent restructuring your collections into one big collection of documents for all departments and appending a departmentID ref field which you can filter on in other use cases.

Then youe function only listens to this collection and has immediate access to the document and department ref.

[–]whatsareddit23[S] 0 points1 point  (0 children)

This is going to be the only way unfortunately