Loading TOC...


   $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.

If you set $retain-history to true, you can use xdmp:document-properties to view the deleted document's properties fragment in the database.

$uri The URI of the document to be purged.
$delete Determines whether or not to delete the documents. Set to true to remove the documents or false to list which documents would have been deleted.
$retain-history Determines whether to retain the deleted document's property fragment in the database. Set to true to retain the property fragment, or false to delete.

Required Privileges

The dls-user role is required to run this function, or the privilege:


// Returns the versions of the 'baz.xml' document and its referenced 
// documents, as specified by the retention policy. 

const dls = require('/MarkLogic/dls');

dls.documentPurge('/foo/bar/baz.xml', false, true);

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.