Loading TOC...

MarkLogic 10 Product Documentation
dbg:eval

dbg:eval(
   $xquery as xs:string,
   [$vars as item()*],
   [$options as (element()|map:map)?]
) as xs:unsignedLong

Summary

Evaluate a string as an XQuery for debugging. Module evaluation will be stopped at the start of the first expression. Returns the request ID after creating the request. Requests evaluated for debugging with dbg:eval are evaluated on the task server, not on the App Server in which they are initiated.

Parameters
xquery The XQuery string to be evaluated. If the XQuery string contains double quotes ("), surround the string with single quotes (').
vars The external variable values for this evaluation. This must be a sequence of even length, alternating QNames and items. Each QName and item pair specify a variable name and value.
options The options node. The default value is (). The node for the dbg:eval options must be in the xdmp:eval namespace. See the xdmp:eval section for a list of options.

Required Privileges

http://marklogic.com/xdmp/privileges/debug-my-requests or http://marklogic.com/xdmp/privileges/debug-any-requests

Usage Notes

The "update" option is not supported.

Example

  dbg:eval("1+1")

=> The ID of the request stopped for debugging
   (for example, 1767394036047154157).  The
   request is evaluated on the task server, and
   you can use the ID to pass into one of the other
   debug functions (for example, dbg:continue or
   dbg:step) to debug the request.
  

Example

xquery version "1.0-ml";

dbg:eval("xdmp:log(xs:string(xdmp:estimate(doc())))", (),
  <options xmlns="xdmp:eval">
    <database>{xdmp:database("Documents")}</database>
  </options>
)

=> The ID of the request stopped for debugging
   (for example, 13942194686892174312).  The
   request is evaluated on the task server, and
   this request will use the "Documents" database
   as its context database.  You can use the ID to
   pass into one of the other debug functions
   (for example, dbg:continue or dbg:step) to
   debug the request.

  

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