op:map( $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.
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: Get the most useful answers to questions from the MarkLogic community, or ask your own question.