Loading TOC...


   $uri as String
) as null


Deletes a document from the database.

$uri The URI of the document to be deleted.

Usage Notes

The xdmp:document-delete function deletes a document and all of its properties, except, when directory-creation is set to automatic or manual-enforced, the directory property; it does not delete a directory with the same URI as the document being deleted unless directory-creation is set to manual. To delete a directory, use the xdmp:directory-delete function.

If a document does not exist at the specified URI, xdmp:document-delete throws an error.



Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.


  • An Example of iterating over a list of uris and delete the document... declareUpdate(); uris = cts.uriMatch("http://dmc-stage-admin.marklogic.com:8005/*"); for (var uri of uris) { xdmp.documentDelete(uri) }
  • To iterate over the list of uris and delete the documents by using their uri. Example: declareUpdate(); uris = cts.uriMatch("/uris/*"); for (var uri of uris) { xdmp.documentDelete(uri) }