Restrict to (the complement of) a set of values
atValues(tjsonb,values) → tjsonb
minusValues(tjsonb,values) → tjsonb
SELECT atValues(tjsonb '[{"vehicleId": 1, "location": "Point(1 1)"}@2001-01-01,
{"vehicleId": 1, "location": "Point(2 2)"}@2001-01-03]',
jsonb '{"vehicleId": 1, "location": "Point(2 2)"}');
-- {[{"location": "Point(2 2)", "vehicleId": 1}@2001-01-03]}
SELECT minusValues(tjsonb '[{"vehicleId": 1, "location": "Point(1 1)"}@2001-01-01,
{"vehicleId": 1, "location": "Point(2 2)"}@2001-01-03]',
jsonb '{"vehicleId": 1, "location": "Point(2 2)"}');
/* {[{"location": "Point(1 1)", "vehicleId": 1}@2001-01-01,
{"location": "Point(1 1)", "vehicleId": 1}@2001-01-03)} */