temporal.nodeReplace( temporal-collection as String, old as Node, new as Node, [temporal-doc-uri as String] ) as null
Replaces a node in a temporal document.
Parameters | |
---|---|
temporal-collection | The URI for the protected temporal collection in which the document is to belong. This must have been previously created by the temporal:collectionCreate function. All versions of the temporal document will be associated with this temporal collection. |
old | The old node, to be replaced. |
new | The new node. |
temporal-doc-uri | The URI of the temporal document to be updated. |
Attribute nodes cannot be replaced by non-attribute nodes. Non-attribute nodes cannot be replaced by attribute nodes. Element nodes cannot have document node children. Document nodes cannot have multiple roots.
If the caller of the function uses function mapping and $old
is an empty sequence, the node-replace
function may return an
empty sequence. It will not return an error.
// assume /foo.json is {"foo":"some value"} // assume tempcol is a temporal collection declareUpdate(); var doc = cts.doc("/foo.json"); var docObj = doc.toObject(); docObj.foo = "this is a different value"; temporal.nodeReplace("tempcol", doc, docObj); // now /foo.json will look like: {"foo":"this is a different value"}