Loading TOC...


   func as function(),
   [options as Object?]
) as Sequence


Returns the result of evaluating a JavaScript function value.

func A zero arity function value to execute.
options Options controlling the evaluation. The default is no options. For detailed option information, see xdmp.invoke for detailed option information. NOTE: Some options require additional privileges; for details, see the Required Privileges section of xdmp.invoke.

Required Privileges

Use of this function requires the following privilege:


Some options require additional privileges. For details, see the Required Privileges for xdmp.invoke.

Usage Notes

The XQuery version of this function (xdmp:invoke-function) can only be used to invoke XQuery functions. The Server-Side JavaScript version of this function (xdmp.invokeFunction) can only be used to invoke JavaScript functions.


  function test29197(uri,doc) {
    return {
      setUri: function setUri(_uri) { uri = _uri; },
      setDoc: function setDoc(_doc) { doc = _doc; },
      insert: function docInsert() { xdmp.documentInsert(uri,doc); }
  var testInvoke = test29197("29197.json",{a:1});

// Insert a doc and then retrieve it. Returns:
//     {"a":1}

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