UNPKG

mingo

Version:

MongoDB query language for in-memory objects

13 lines (12 loc) 367 B
import { computeValue } from "../../core/_internal"; import { assert, isObject } from "../../util"; const $replaceWith = (collection, expr, options) => { return collection.map((obj) => { obj = computeValue(obj, expr, null, options); assert(isObject(obj), "$replaceWith expression must return an object"); return obj; }); }; export { $replaceWith };