Accessing reduced values in the view

Hello -

We have a validation project where we need to SUM() documents of a certain type, then compare the results to a value inside another document. Example:

account-00001 {
accountName: "Customer 1"
accountTotal: "5000.00"
}

trans-00001 {
accountID: "00001",
transactions: [
     { 
      transID: "10001",
      transTotal: "4000.00",
      transDesc "Purchase XYX"
     },
     {
     transID: "10002",
     transTotal: "500.00",
     transDesc: "Purchase ABC"
     },
     {
     transID: "10003",
     transTotal: "500.00",
     transDesc: "Another Purchase DEF"
    }
]
}

We want to SUM() the total of all transactions in the trans-00001 document, and compare it in the view to the accountTotal in the account-00001 document such that we only emit the keys of the documents where the accountTotal and SUM(transTotal) DON’T match. The view would then drive a report to show accounts we need to follow up on where the total of the transactions doesn’t match the stored account total.

Is it possible to do this all within the view? We would want to emit the account key, and the values would be the accountTotal and SUM(transTotal) to show the discrepancy.