dls:document-version-delete( $uri as xs:string, $version as xs:integer, $retain-history as xs:boolean ) as empty-sequence()
This function removes the specified version of the managed document at the specified URI. This overrides any configured retention policies and should be used with care. You must have update permissions on the document version in order to delete it.
If you set$retain-history
to true
, you can use
xdmp:document-properties
to view the deleted document's properties
fragment in the database. For example, if you had deleted version 1 of
/foo/bar/baz.xml
, you can view its properties by calling:
xdmp:document-properties("/foo/bar/baz.xml_versions/1-baz.xml")
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-version-delete("/foo/bar/baz.xml", 1, fn:true()) (: Deletes version 1 of the 'baz.xml' document and records it in the document history. :)
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.