mongoose - Delete all referenced objects when deleting referencing object

37 views Asked by At

I have two collections in my app. (Table and Buckets)

Table collection

enter image description here enter image description here

Bucket collection

enter image description here enter image description here


Here each one site has many buckets. I want to delete all buckets and data using site id (site field in table collection)

If it's duplicated, feel free to close this question, but I didn't find the answer after googling, stack overflowing and in the related topics.

Thanks for your help!

0

There are 0 answers