mingo
Version:
MongoDB query language for in-memory objects
15 lines (14 loc) • 443 B
JavaScript
import { assert, isArray } from "../../util";
import { DEFAULT_OPTIONS } from "./_internal";
import { $pull } from "./pull";
function $pullAll(expr, arrayFilters = [], options = DEFAULT_OPTIONS) {
const pullExpr = {};
for (const k of Object.keys(expr)) {
assert(isArray(expr[k]), `$pullAll requires an array argument.`);
pullExpr[k] = { $in: expr[k] };
}
return $pull(pullExpr, arrayFilters, options);
}
export {
$pullAll
};