dls.documentDelete

dls.documentDelete(
   uri as String,
   keep-old-versions as Boolean,
   retain-history as Boolean
) as null

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.documentProperties 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

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

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

declareUpdate();
dls.documentDelete('/foo/bar/baz.xml', false, true);
   
Powered by MarkLogic Server | Terms of Use | Privacy Policy