temporal.documentProtect( temporal-collection as String, uri as String, [options as Object?] ) as null
Protects a temporal document from certain temporal operations, such as update, delete or wipe for a specific period of time. Subsequent update operations on that document against which this operation is protected will get a TEMPORAL-PROTECTED exception. If an archive path is specified optionally save a serialized copy of the document to the specified location and record the file path and copy time in the document's metadata.
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. |
uri | The URI to be used to identify the document in the database. If the document is not the latest version, a suffix will be concatenated to the document URI with a dot as the new URI of the document. |
options |
Options with which to customize this operation. This function supports the following
options:
|
http://marklogic.com/xdmp/privileges/temporal-document-protect
or the one user specified for this temporal collection.
CamelCased option names should be used if the options are specified as map:map.
TEMPORAL-NOEXTIME is thrown if archive path option is specified and no expire time or duration option is specified.
When archive path option is specified, the latest version of the temporal document will be archived if it exists; else the version with the temporal document URI will be archived. If none of the above exists (such as the temporal document is deleted and version URI is used to create them), the protection will still be applied but no archive copy will be made.
declareUpdate(); temporal.documentProtect('bitemp','tempdoc3.xml', {archivePath: 'blah.xml', expireTime: '2019-09-22T23:59:19.340475Z', duration: 'PT5D'})
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.