You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Adds numbers together or adds numbers and a date. If one of the arguments is a date, $add treats the other arguments as milliseconds to add to the date." documentation link.
The current implementation just sums values, this change would make it work as intended
/** * Computes the sum of an array of numbers. * * @param obj * @param expr * @returns {Object} */$add(obj,expr){varargs=computeValue(obj,expr)vardate=args.find(function(argument){returnargumentinstanceofDate;})if(date){args=args.map(function(argument){if(argumentinstanceofDate){returnargument.getTime()}returnargument});}varreduced=reduce(args,function(acc,num){returnacc+num},0);if(date){returnnewDate(reduced);}returnreduced;},
The text was updated successfully, but these errors were encountered:
From mongo documentation:
"Adds numbers together or adds numbers and a date. If one of the arguments is a date, $add treats the other arguments as milliseconds to add to the date." documentation link.
The current implementation just sums values, this change would make it work as intended
The text was updated successfully, but these errors were encountered: