Make document related other document like excel

I have a document what get the previous document’s data to calculate the current document’s data. They are in the same collection.
You can think of them like excel sheets.
Does anyone know how to set them up with mongodb or any other database. I intend to use transaction but I’m not sure mongo can handle several thousand update commands in one transaction.