Best Approach for Updating Related Collections When Client Document Changes
- 0
- Self Hosted
- Databases
- General
I have a Clients collection, and several other collections (ClientFollowUps, ClientHealths, ClientTracks, etc.) that contain a ClientId field referencing the Clients collection. Document security is enabled for all of them.
When creating or updating a Client document, I pass a Permission[] array along with the payload. This same Permission[] is also provided when creating documents in the ClientFollowUps, ClientHealth, and ClientTracks collections, derived from the specific client document.
I realized that whenever a Client document is updated, I also need to update the permissions in all related collections (ClientFollowUps, ClientHealths, ClientTracks, etc.) where the ClientId matches the client being updated.
Technically, it's possible to do this by querying all related documents and updating them whenever the specific client document is updated.
Given your experience and expertise, would you suggest continuing with this approach of updating all related collections whenever the client document is updated, or is there a better way to handle this?
Recommended threads
- MongoDb Database Breaks integer[] & bigi...
I've got a table with the below column created. When I try to insert the value `[-3408048000]` into it, the dart sdk cloud function call is successful (no error...
- Delete on cascade from Cloud Function
I'm writing a Python function that deletes a user's main row from a table in my database. This row has relationships with other tables that use cascade deletion...
- 1.9.6 Console handles all array columns ...
When creating or updating a row in the appwrite 1.9.6 web console, the form treats all list columns as a type string. Even if the column is a list of booleans, ...