
AccessPlan.prototype.notExistsJoin( rightPlan as String, [keys as ondef | ondef[]], [condition as xs.boolean] ) as ModifyPlan
This method is a filtering join that filters based on whether the join exists or not but doesn't add any columns.
It filters the left row set to the rows that don't have a join in the right row set.
| Parameters | |
|---|---|
| rightPlan | The row set from the right view. |
| keys | Equality condition(s) expressed using one or more calls to the function op.on. These conditions are used to compare the left and right rows. |
| condition | A boolean expression used to compare the left and right rows. See Boolean Expression Functions for the list of functions used to build boolean expressions. |
keys and condition are used to specify
the join condition. keys allows for a simplified syntax
for equality join condition. While condition allows for
inequality and complex join conditions.
This method combines keys and condition
using an AND operator such that:
view
.notExistsJoin(
otherView,
op.on(view.col('column1'), otherView.col('column2')),
op.ge(view.col('column3'), otherView.col('column4'))
)
is the same as
view
.notExistsJoin(
otherView,
null,
op.and(
op.eq(view.col('column1'), otherView.col('column2')),
op.ge(view.col('column3'), otherView.col('column4'))
)
)
notExistsJoin is a method of the following classes:
// It filters out {'r1':2, 'k1':'b'} in p1 as value 'b' doesn't exist in column 'k2' of p2
const op = require('/MarkLogic/optic');
const p1 = op.fromLiterals([
{'r1':1, 'k1':'a'},
{'r1':2, 'k1':'b'}
]);
const p2 = op.fromLiterals([
{'r2':3, 'k2':'a'},
{'r2':4, 'k2':'c'}
]);
p1.notExistsJoin(p2, op.on('k1', 'k2')).result();
'use strict';
const op = require('/MarkLogic/optic');
const fruits = op.fromLiterals([
{"fruit" : "mango", "count" : 10},
{"fruit" : "apple", "count" : 7},
{"fruit" : "orange", "count" : 9}
]);
const orders = op.fromLiterals([
{"flavor" : "apple", "cups" : 5},
{"flavor" : "orange", "cups" : 14}
]);
fruits.notExistsJoin(
orders,
op.on(op.col('fruit'), op.col('flavor')),
op.ge(op.col('count'), op.col('cups'))
)
.result()
/*
row with fruit of 'mango' and 'orange' will be returned without data from orders
*/