MarkLogic 10 Product Documentation
op:except

op:except(
   $leftPlan as map:map,
   $rightPlan as map:map
) as map:map

Summary

This method restricts the left row set to rows where a row with the same columns and values doesn't exist in the right row set.

Parameters
$leftPlan The row set from the left view.
$rightPlan The row set from the right view.

Example

xquery version "1.0-ml";

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

let $tab1 := op:from-literals((
   map:entry("id", 1) => map:with("val", "a"),
   map:entry("id", 2) => map:with("val", "b"),
   map:entry("id", 3) => map:with("val", "c")
   ))
let $tab2  := op:from-literals((
   map:entry("id", 1) => map:with("val", "x"),
   map:entry("id", 2) => map:with("val", "b"),
   map:entry("id", 3) => map:with("val", "c"),
   map:entry("id", 4) => map:with("val", "n")
   ))
return $tab2
   => op:except($tab1)
   => op:order-by("id")
   => op:result()
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy