dls:purge( $delete as xs:boolean, $retain-history as xs:boolean ) as xs:string*
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:retention-rule
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: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
xquery version "1.0-ml"; import module namespace dls = "http://marklogic.com/xdmp/dls" at "/MarkLogic/dls.xqy"; dls:document-purge(fn:true(), fn:true()) (: Deletes all of the versions of the 'baz.xml' document and its referenced documents. :)
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.