Schema consistency

Lets say I have one to many relationship in the database. What happens if object A gets deleted. Does object B automatically gets deleted as well?

is it possible to set up a cascade policy somewhere?

Actually, I"m curious about this as well! Has anyone thought into this? My initial thinking would be no, the secondary data would be just dark data that doesnโ€™t get applied to anything but would still exist.

Sort of like, if you delete a blog post, the comments still could theoretically exist in the db, but they would never be rendered b/c that blog post wouldnโ€™t ever be rendered first.

1 Like

I am also wondering about afterSave https://docs.moralis.io/moralis-server/cloud-code/triggers#aftersave

What happens if the operation in afterSave fails? Is the object still saved?

My impression is that the object was already saved before afterSave is triggered

1 Like

Can we get some docs around this topic pls?
its super important to know about these things when building any complex app.

it looks like you could delete more objects in same command: https://stackoverflow.com/questions/41818801/parse-server-cloud-code-cascade-delete-objects-from-multiple-classes

1 Like