0
votes

Is there a way to update bitemporal documents that were ingested in MarkLogic-8 in Marklogic-9? Currently the temporal update apis only work for documents which are ingested in ML-9 or later. Please suggest. Following error is getting generated:

The metadata TemporalDocURI not found. Temporal node update builtins only work for temporal documents created with ML9 or later

2

2 Answers

1
votes

In order to upgrade them you just need to run temporal:document-insert on them with ML9. You should be able to do this without making any changes to the document content for a "clean" upgrade.

0
votes

To make the ML-8 bi temporal documents updatable in ML-9, we will need to add new metadata "temporalDocURI" to the existing document URI where we want to make the update.

Sample Code:

let $uri := "/documents/test.xml"
return xdmp:document-put-metadata(
$uri,map:map(<map:map xmlns:map="http://marklogic.com/xdmp/map">
  <map:entry key="temporalDocURI">
    <map:value>{$uri}</map:value>
  </map:entry>
</map:map>))

Once the metadata is added to the bitemporal document which we want to update, the temporal apis for node update or insert will work for all documents inserted prior to ML-9.

Note In order for the 'xdmp:document-put-metadata' API to work on temporal documents, it will need override privilege for the temporal collection the temporal document belongs to, and if the user making the change is not an admin user, then granular execute privilege needs to be added for the user and then perform the 'xdmp:document-put-metadata'.