Update
Add/Update specific fields in single/multiple documents.

The Story So Far...

Kenny has joined the manufacturing department as the Safety Officer in-charge, and all employee entries are now correctly recorded in the HRMS.
It is now annual appraisal time, and Stan has been working extra hard the last few weeks to stay on the good books of Eric. Eric has taken note of this and has decided to promote Stan to the rank of Senior Plant Manager. Kyle is not too happy about this, since he too has been going the extra mile, hoping to bag that promotion. Alas, he failed to make his efforts adequately visible to Eric. Bummer, but Kyle has learnt a few tricks from observing Stan, and holds out hope for next time.
We need to update Stan's role in the HRMS. However, we note that it is not enough to just update the role, although RecallGraph will track history for the change - we need to also somehow keep track of the effective date from which his promotion is valid. In real-world scenarios, this may not be the same as the time of entry of the new information, which may be done preemptively or retroactively.
RecallGraph is not yet fully bi-temporal. If it were, there would be a dedicated valid time field which could be used to track the effective promotion date. As of this writing, RecallGraph only tracks transaction time, i.e. the time at which data was actually entered into the system.
For a special case of real-time applications, the valid time may be considered to be the same as the transaction time, but an HRMS is not such a case. Through this guide, we will also explore the possibility of any tricks that may be available to work around the lack of an explicit valid time field.
To keep track of the effective promotion date, we will start marking each write operation with a user-defined timestamp, which we will call valid_from. Note that this can only work for creates and updates, and not for delete operations.
User-defined valid time fields can only be used for create and update operations, not for delete operations.

Entering Data

In the Swagger console locate the tab with the
button. The collection parameter should be set to employees and the body should contain only the new and the changed content of the entity.
One of _key or _id would still need to be present.
Request Body:
{ "_key": "44794453", "role": "Senior Plant Manager", "valid_from": "2020-05-07" }
Response:
{
"_id": "employees/44794453",
"_key": "44794453",
"_rev": "_acx_g1C--_",
"_oldRev": "_aclQHSa---"
}

End Result

//Query
for e in employees
filter e._key == '44794453'
return e
//Result
[
{
"_key": "44794453",
"_id": "employees/44794453",
"_rev": "_acx_g1C--_",
"first_name": "Stan",
"last_name": "Marsh",
"role": "Senior Plant Manager",
"valid_from": "2020-05-07"
}
]
Although not demonstrated in this example, this endpoint also supports bulk update, similar to CREATE.
Last modified 2yr ago