Loading TOC...

MarkLogic Server 11.0 Product Documentation
dls:document-checkout

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

Summary

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.

Parameters
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:
http://marklogic.com/xdmp/privileges/dls-user

Example

  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.