Loading TOC...

MarkLogic Server 11.0 Product Documentation
dls:document-version-delete

dls:document-version-delete(
   $uri as xs:string,
   $version as xs:integer,
   $retain-history as xs:boolean
) as empty-sequence()

Summary

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")

Parameters
uri The URI of the document.
version The version of the document to be deleted.
retain-history Determines whether or not to retain the document's properties fragment in the database. Set to true to retain the deleted document's properties in order to track when the document was deleted and by whom. Otherwise, set to false.

Required Privileges

The dls-user role is required to run this function, or the privilege:
http://marklogic.com/xdmp/privileges/dls-user

Example

  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 iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.