dls.documentPurge( uri as String, delete as Boolean, retain-history as Boolean ) as Sequence
This function deletes all numbered versions of the specified
managed document and its referenced documents, as specified by the retention
policies set by
dls.retentionRule
. The document versions are
deleted if they
have no retention rule causing them to be kept and if they are not included
by documents that cannot yet be deleted. If $delete
is
false
, the document's versions are not actually deleted and instead
a list of the documents that would have been deleted is returned.
$retain-history
to true
, you can use
xdmp:document-properties
to view the deleted document's properties
fragment in the database.
dls-user
role is required to run
this function, or the privilege:http://marklogic.com/xdmp/privileges/dls-user
// Returns the versions of the 'baz.xml' document and its referenced // documents, as specified by the retention policy. const dls = require('/MarkLogic/dls'); declareUpdate(); dls.documentPurge('/foo/bar/baz.xml', false, true);