| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 | 
							- "use strict";
 
- /** 
 
-  * Internal expression for constant values 
 
-  * @class ConstantExpression
 
-  * @namespace mungedb-aggregate.pipeline.expressions
 
-  * @module mungedb-aggregate
 
-  * @constructor
 
-  **/
 
- var ConstantExpression = module.exports = function ConstantExpression(value){
 
- 	if (arguments.length !== 1) throw new Error("args expected: value");
 
- 	this.value = value;	//TODO: actually make read-only in terms of JS?
 
- 	base.call(this);
 
- }, klass = ConstantExpression, base = require("./Expression"), proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
 
- // PROTOTYPE MEMBERS
 
- proto.getOpName = function getOpName(){
 
- 	return "$const";
 
- };
 
- /**
 
-  * Get the constant value represented by this Expression.
 
-  * @method getValue
 
-  * @returns the value
 
-  **/
 
- proto.getValue = function getValue(){	//TODO: convert this to an instance field rather than a property
 
- 	return this.value;
 
- };
 
- proto.addDependencies = function addDependencies(deps, path) {
 
- 	// nothing to do
 
- };
 
- /**
 
-  * Get the constant value represented by this Expression.
 
-  * @method evaluate
 
-  **/
 
- proto.evaluate = function evaluate(doc){
 
- 	return this.value;
 
- };
 
- proto.optimize = function optimize() {
 
- 	return this; // nothing to do
 
- };
 
- proto.toJSON = function(isExpressionRequired){
 
- 	return isExpressionRequired ? {$const: this.value} : this.value;
 
- };
 
- //TODO:	proto.addToBsonObj   --- may be required for $project to work -- my hope is that we can implement toJSON methods all around and use that instead
 
- //TODO:	proto.addToBsonArray
 
 
  |