I am new with Firebase and I am using the field reference so I can link different documents in different collections. If the user want to delete his account so everything were connected with references should also be deleted automatically.(In the image the company of the user will also be deleted when the user delete his account). So in my code I can delete the user but I couldn't delete the company using the reference. Maybe can someone help?
exports.userDelete = functions.auth.user().onDelete ( user => {
firestore.collection("users").doc(user.uid).delete();
//user.company.delete(); not working
})