Loading TOC...


   $uri as xs:string,
   $deep as xs:boolean,
   [$annotation as item()?],
   [$timeout as xs:unsignedLong?]
) as empty-sequence()


This function checks out (locks) the document at the specified URI to prevent other users from modifying the document. An exception is thrown if the document does not yet exist or does exist but is not managed.

This function must be called in a separate transaction from the dls:document-update and dls:document-checkin functions.

uri The URI of the document to check out.
deep If set to true, then any documents directly or indirectly included by the specified document are also checked out.
annotation Any comments you want to add to the document's active-lock element.
timeout The duration of the checkout, in seconds. For infinite, omit this parameter or specify ().

Required Privileges

The dls-user role is required to run this function, or the privilege:


  xquery version "1.0-ml";

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

  dls:document-checkout("/foo/bar/baz.xml", fn:true(), "updating doc", 3600)

  (: Checks out the 'baz'xml' document, and all of its included documents,
     for one hour. :)

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