dls.documentDelete( 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.
dls-user
role is required to run
this function, or the privilege:http://marklogic.com/xdmp/privileges/dls-user
// 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);