Loading TOC...

dls.documentCheckout

dls.documentCheckout(
   $uri as String,
   $deep as Boolean,
   [$annotation as Item?],
   [$timeout as (Number|String)?]
) as null

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.documentUpdate and dls.documentCheckin 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

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

const dls = require('/MarkLogic/dls');

declareUpdate();
dls.documentCheckout('/foo/bar/baz.xml', true, 'updating doc', 3600);
   

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