|
|
@@ -2,7 +2,7 @@
|
|
|
|
|
|
/**
|
|
|
* An $hour pipeline expression.
|
|
|
- * @see evaluate
|
|
|
+ * @see evaluateInternal
|
|
|
* @class HourExpression
|
|
|
* @namespace mungedb-aggregate.pipeline.expressions
|
|
|
* @module mungedb-aggregate
|
|
|
@@ -18,17 +18,19 @@ proto.getOpName = function getOpName(){
|
|
|
return "$hour";
|
|
|
};
|
|
|
|
|
|
-proto.addOperand = function addOperand(expr) {
|
|
|
- this.checkArgLimit(1);
|
|
|
- base.prototype.addOperand.call(this, expr);
|
|
|
-};
|
|
|
+// DEPENDENCIES
|
|
|
+var Expression = require("./Expression");
|
|
|
|
|
|
/**
|
|
|
* Takes a date and returns the hour between 0 and 23.
|
|
|
- * @method evaluate
|
|
|
+ * @method evaluateInternal
|
|
|
**/
|
|
|
-proto.evaluate = function evaluate(doc){
|
|
|
+proto.evaluateInternal = function evaluateInternal(doc){
|
|
|
this.checkArgCount(1);
|
|
|
- var date = this.operands[0].evaluate(doc);
|
|
|
+ var date = this.operands[0].evaluateInternal(doc);
|
|
|
return date.getUTCHours();
|
|
|
};
|
|
|
+
|
|
|
+
|
|
|
+/** Register Expression */
|
|
|
+Expression.registerExpression("$hour",HourExpression.parse);
|