mrr.sj.front/node_modules/mingo/dist/esm/operators/update/currentDate.js

24 lines
467 B
JavaScript

import {
applyUpdate,
UPDATE_OPTIONS,
walkExpression
} from "./_internal";
const $currentDate = (obj, expr, arrayFilters = [], options = UPDATE_OPTIONS) => {
const now = Date.now();
return walkExpression(expr, arrayFilters, options, (_, node, queries) => {
return applyUpdate(
obj,
node,
queries,
(o, k) => {
o[k] = now;
return true;
},
{ buildGraph: true }
);
});
};
export {
$currentDate
};