Update document based on another document

We have a situation where we want to compute information of the first document based on a second document that comes in later. Is there an easy way/recommended API to accomplish this?

Document 1:
{"id": "xyz", "timestamp": t1}

Document 2:
{"another_field": "relates back to document 1 via id, xyz", "timestamp": t2}

Finally, I need to go back and update document 1 as:
{"id": "xyz", "time_elapsed": t2-t1, "timestamp": t1}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.