Loading TOC...


   $plan as map:map,
   $mapper as function(item()) as item()*
) as map:map


This method applies the specified function to each row returned by the plan to produce a different result row.

$plan The Optic Plan. You can either use the XQuery => chaining operator or specify the variable that captures the return value from the previous operation.
$mapper The function to be applied.

Usage Notes

The primary use case for the map() operation is when executing a command from a different context such as when using the /v1/rows endpoint of the REST API and using a library installed in the modules database to postprocess rows on the enode.


xquery version "1.0-ml";

import module namespace op="http://marklogic.com/optic"
     at "/MarkLogic/optic.xqy";

let $employees := op:from-view("main", "employees")

return $employees
   => op:order-by("EmployeeID")
   => op:map(function($row as map:map) {
             map:with($row, "seconds", floor(seconds-from-dateTime(current-dateTime())))
   => op:result()

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