Loading TOC...

MarkLogic Server 11.0 Product Documentation
temporal:document-delete

temporal:document-delete(
   $temporal-collection as xs:string,
   $uri as xs:string,
   [$options as (element()|map:map)?]
) as empty-sequence()

Summary

This function deletes the temporal document identified by the given URI. Note that temporal documents are not actually deleted, but are rather "logically deleted" and remain in the database with system end times set to the time of the deletion.

Parameters
temporal-collection The collection that contains the temnporal document to be deleted.
uri The URI of the temporal document to be deleted.
options Options with which to customize this operation. You can specify options in either an XML options element in the "temporal:document-delete" namespace, or as a map:map. The options names below are XML element localnames. When using a map, replace any hyphens in an option name with camel casing. For example, "an-option" becomes "anOption" when used as a map:map key. This function supports the following options:
if-not-exists
Action if no document exists with the URI. Valid values are "error" and "allow". Default value is "error". A TEMPORAL-DOCNOTFOUND exception is thrown if the document does not exist in the named collection when "error" is specified or if this option is left unspecified.

Example

xquery version "1.0-ml";

import module namespace temporal = "http://marklogic.com/xdmp/temporal"
      at "/MarkLogic/temporal.xqy";

temporal:document-delete("temporalCollection", "doc.xml")

(: Deletes the "doc.xml" document from the temporalCollection. :)

Example

xquery version "1.0-ml";

import module namespace temporal = "http://marklogic.com/xdmp/temporal"
      at "/MarkLogic/temporal.xqy";

temporal:document-delete("temporalCollection", "doc.xml",
  <options xmlns="xdmp:document-delete">
    <if-not-exists>allow</if-not-exists>
  </options>)

(: Deletes the "doc.xml" document from the temporalCollection if it exists. :)

Example

xquery version "1.0-ml";

import module namespace temporal = "http://marklogic.com/xdmp/temporal"
      at "/MarkLogic/temporal.xqy";

temporal:document-delete(
  "temporalCollection", 
  "doc.xml",
  map:map() => map:with("ifNotExists", "allow"))

(: Deletes the "doc.xml" document from the temporalCollection if it exists. :)

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