| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- "use strict";
- /**
- * Get the DayOfMonth from a date.
- * @class DayOfMonthExpression
- * @namespace mungedb-aggregate.pipeline.expressions
- * @module mungedb-aggregate
- * @constructor
- **/
- var DayOfMonthExpression = module.exports = function DayOfMonthExpression() {
- base.call(this);
- }, klass = DayOfMonthExpression,
- FixedArityExpression = require("./FixedArityExpressionT")(klass, 1),
- base = FixedArityExpression,
- proto = klass.prototype = Object.create(base.prototype, {
- constructor: {
- value: klass
- }
- });
- // DEPENDENCIES
- var Expression = require("./Expression");
- // PROTOTYPE MEMBERS
- proto.getOpName = function getOpName() {
- return "$dayOfMonth";
- };
- /**
- * Takes a date and returns the day of the month as a number between 1 and 31.
- * @method evaluate
- **/
- proto.evaluateInternal = function evaluateInternal(vars) {
- var date = this.operands[0].evaluateInternal(vars);
- return date.getUTCDate();
- };
- /** Register Expression */
- Expression.registerExpression("$dayOfMonth", base.parse);
|