Please, Help me with embedded view!

Hello!!!I have some problems with view.

In my DB I created “Main ” document and “Response” document. In “Main ” document I placed embedded view, which displayes “Response” documents related only to the current “Main” document. So I want to realise summation operation of “amount”, field which belongs to “Response” document, and display the result in the field of the “Main” document.

I shall be grateful for any help!

Subject: Please, Help me with embedded view!!!

You could achieve this using a simple @DbLookup() into a response view, using the parent key, returning a list of “amount” values.

Then compute the sum of this list using @Sum()

Subject: RE: Please, Help me with embedded view!!!

Thank you for your help, Morten!!!I’ll try to do it

I achieved the same result using document collection

I created doc. collection, which contained children documents then I summarized values of “amount” field and wrote it in the “result” field of "Main"doc.

But I think that it take too much time

thank you again!!!