MarkLogic 9 Product Documentation
dls:document-delete

dls:document-delete(
   $uri as xs:string,
   $keep-old-versions as xs:boolean,
   $retain-history as xs:boolean
) as empty-sequence()

Summary

This function removes the specified managed document. You must have update permissions on the document 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.

Parameters
uri The URI of the document.
keep-old-versions Determines whether to keep old versions of the document. Set to false to delete all of the versions of the document.
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:
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-delete("/foo/bar/baz.xml", fn:false(), fn:true())

  (: Deletes all versions of the 'baz.xml' document and retains the
     property fragment for each version. :)
    
Powered by MarkLogic Server | Terms of Use | Privacy Policy