ON CASCADE statements

Can you manage with just having each B document reference its parent A document? If you need the array in A, then unfortunately, as Laurent said, you need to maintain that array for now.

For consistency, you could remove the B reference from the array before deleting B.