Loading TOC...


   $uri as String,
   $keep-old-versions as Boolean,
   $retain-history as Boolean
) as null


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.documentProperties to view the deleted document's properties fragment in the database.

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


// Deletes all versions of the 'baz.xml' document and retains the
// property fragment for each version.

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

dls.documentDelete('/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.