| 
					
				 | 
			
			
				@@ -139,13 +139,16 @@ var Expression = module.exports = (function(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	/** Parse an Object.  The object could represent a functional expression or a Document expression. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	| @param obj	the element representing the object 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	| @param ctx	a MiniCtx representing the options above 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	| @returns the parsed Expression 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	| An object expression can take any of the following forms: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	|	f0: {f1: ..., f2: ..., f3: ...} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	|	f0: {$operator:[operand1, operand2, ...]} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* Parse an Object.  The object could represent a functional expression or a Document expression. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* @param obj	the element representing the object 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* @param ctx	a MiniCtx representing the options above 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* @returns the parsed Expression 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* An object expression can take any of the following forms: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	*	f0: {f1: ..., f2: ..., f3: ...} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	*	f0: {$operator:[operand1, operand2, ...]} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	**/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	klass.parseObject = function parseObject(obj, ctx){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if(!(ctx instanceof ObjectCtx)) throw new Error("ctx must be ObjectCtx"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -203,10 +206,12 @@ var Expression = module.exports = (function(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return expr; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	/** Parse a BSONElement Object which has already been determined to be functional expression. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	| @param opName	the name of the (prefix) operator 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	| @param obj	the BSONElement to parse 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	| @returns the parsed Expression 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* Parse a BSONElement Object which has already been determined to be functional expression. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* @param opName	the name of the (prefix) operator 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* @param obj	the BSONElement to parse 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* @returns the parsed Expression 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	**/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	klass.parseExpression = function parseExpression(opName, obj) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		// look for the specified operator 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -240,9 +245,11 @@ var Expression = module.exports = (function(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return expr; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	/** Parse a BSONElement which is an operand in an Expression. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	| @param pBsonElement the expected operand's BSONElement 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	| @returns the parsed operand, as an Expression 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* Parse a BSONElement which is an operand in an Expression. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* @param pBsonElement the expected operand's BSONElement 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* @returns the parsed operand, as an Expression 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	**/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	klass.parseOperand = function parseOperand(obj){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		var t = typeof(obj); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -254,10 +261,12 @@ var Expression = module.exports = (function(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		else return new ConstantExpression(obj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	/** Produce a field path string with the field prefix removed. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	| @param prefixedField the prefixed field 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	| @returns the field path with the prefix removed 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	| Throws an error if the field prefix is not present. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* Produce a field path string with the field prefix removed. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* Throws an error if the field prefix is not present. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* @param prefixedField the prefixed field 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* @returns the field path with the prefix removed 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	**/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	klass.removeFieldPrefix = function removeFieldPrefix(prefixedField) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if (prefixedField.indexOf("\0") != -1) throw new Error("field path must not contain embedded null characters; code 16419"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -274,30 +283,39 @@ var Expression = module.exports = (function(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	// PROTOTYPE MEMBERS 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	/*** Evaluate the Expression using the given document as input. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	| @returns the computed value 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	/*** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* Evaluate the Expression using the given document as input. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* @returns the computed value 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	***/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	proto.evaluate = function evaluate(obj) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		throw new Error("WAS NOT IMPLEMENTED BY INHERITOR!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	/** Optimize the Expression. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	| This provides an opportunity to do constant folding, or to collapse nested 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	|  operators that have the same precedence, such as $add, $and, or $or. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	| The Expression should be replaced with the return value, which may or may 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	|  not be the same object.  In the case of constant folding, a computed 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	|  expression may be replaced by a constant. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	| @returns the optimized Expression 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* Optimize the Expression. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* This provides an opportunity to do constant folding, or to collapse nested 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	*  operators that have the same precedence, such as $add, $and, or $or. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* The Expression should be replaced with the return value, which may or may 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	*  not be the same object.  In the case of constant folding, a computed 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	*  expression may be replaced by a constant. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* @returns the optimized Expression 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	**/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	proto.optimize = function optimize() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		throw new Error("WAS NOT IMPLEMENTED BY INHERITOR!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	/** Add this expression's field dependencies to the set Expressions are trees, so this is often recursive. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	| @param deps	output parameter 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	| @param path	path to self if all ancestors are ExpressionObjects. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	| Top-level ExpressionObject gets pointer to empty vector. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	| If any other Expression is an ancestor, or in other cases where {a:1} inclusion objects aren't allowed, they get NULL. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* Add this expression's field dependencies to the set Expressions are trees, so this is often recursive. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* Top-level ExpressionObject gets pointer to empty vector. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* If any other Expression is an ancestor, or in other cases where {a:1} inclusion objects aren't allowed, they get NULL. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* @param deps	output parameter 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	* @param path	path to self if all ancestors are ExpressionObjects. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	**/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	proto.addDependencies = function addDependencies(deps, path) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		throw new Error("WAS NOT IMPLEMENTED BY INHERITOR!"); 
			 |