xdmp:document-delete( $uri as xs:string, [$options as (element()|map:map)?] ) as empty-sequence()
Deletes a document from the database.
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.
xdmp:document-delete("example.xml")
(: Enable deletion of a non-existent document without error, using : options expressed as an XML options node. :) xdmp:document-delete("example.xml", <options xmlns="xdmp:document-delete"> <if-not-exists>allow</if-not-exists> </options>)
(: Enable deletion of a non-existent document without error, using : options expressed as map:map. :) xdmp:document-delete("example.xml", map:map() => map:with("ifNotExists", "allow"))
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.