dls.purge( delete as Boolean, retain-history as Boolean ) as Sequence
This function deletes all numbered versions of managed documents and
its referenced documents (such as /foo/bar.xml_versions/1-bar.xml
), as
specified by the retention policy set by one or more
dls.retentionRule
functions. Documents are deleted if they
have no retention rule causing them to be kept and if they are not included
by some document that cannot yet be deleted. If $delete
is
false
, the document versions are not actually deleted and instead
a list of the documents that would have been deleted is returned. This function
returns a list of URIs that it would/did delete.
$retain-history
to true
, you can use
xdmp.documentProperties
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
// Deletes all of the versions of the 'baz.xml' document and its // referenced documents. const dls = require('/MarkLogic/dls'); declareUpdate(); dls.purge(true, true);
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.