Loading TOC...

xdmp.describe

xdmp.describe(
   item as Sequence,
   [max-sequence-length as Number?],
   [max-item-length as Number?]
) as String

Summary

Returns a string representing the description of a given item sequence. If you take the output of this function and evaluate it as an XQuery program, it returns the item(s) input to the function.

Parameters
item The item sequence whose description is returned.
max-sequence-length Represents the maximum number of items per sequence to print. The default is 3.
max-item-length Represents the maximum number of characters per item to print. The default is 64. The minimum is 8.

Usage Notes

If you specify an item that is in a database, this function returns the path to the item (or to the items if you specify multiple items). If the item or items are constructed in XQuery, then it prints out the item, truncating the characters in each item according to the max-item-length parameter.

Example

xdmp.describe(fn.currentDate());

=> xs.dateTime("2014-11-06T08:00:00")

Example

var x = xdmp.toJSON({key:"value"});
xdmp.describe(x);

  => document{{"key":"value"}}

Example

//  assume /mydoc.json is a JSON document with the following content:
//    {key: "value"}
xdmp.describe(cts.doc("/mydoc.json").root.key)

  => fn.head(xdmp.unpath("fn:doc('/mydoc.json')/text('key')"))

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