Browse Source

Refs #1879: Fixed jshint and pkg rename issues

Kyle Davis 12 years ago
parent
commit
e382544f4e
100 changed files with 741 additions and 622 deletions
  1. 0 1
      index.js
  2. 4 11
      lib/Aggregator.js
  3. 2 4
      lib/Cursor.js
  4. 17 7
      lib/commands/PipelineCommand.js
  5. 13 0
      lib/index.js
  6. 30 22
      lib/pipeline/Document.js
  7. 33 33
      lib/pipeline/FieldPath.js
  8. 8 7
      lib/pipeline/Pipeline.js
  9. 1 0
      lib/pipeline/PipelineD.js
  10. 18 16
      lib/pipeline/Value.js
  11. 10 9
      lib/pipeline/accumulators/Accumulator.js
  12. 1 0
      lib/pipeline/accumulators/AddToSetAccumulator.js
  13. 1 0
      lib/pipeline/accumulators/AvgAccumulator.js
  14. 1 0
      lib/pipeline/accumulators/FirstAccumulator.js
  15. 1 0
      lib/pipeline/accumulators/LastAccumulator.js
  16. 1 0
      lib/pipeline/accumulators/MinMaxAccumulator.js
  17. 1 0
      lib/pipeline/accumulators/PushAccumulator.js
  18. 1 0
      lib/pipeline/accumulators/SingleValueAccumulator.js
  19. 1 0
      lib/pipeline/accumulators/SumAccumulator.js
  20. 8 7
      lib/pipeline/accumulators/index.js
  21. 1 0
      lib/pipeline/documentSources/CursorDocumentSource.js
  22. 1 0
      lib/pipeline/documentSources/DocumentSource.js
  23. 1 0
      lib/pipeline/documentSources/FilterBaseDocumentSource.js
  24. 5 2
      lib/pipeline/documentSources/GroupDocumentSource.js
  25. 1 0
      lib/pipeline/documentSources/LimitDocumentSource.js
  26. 1 0
      lib/pipeline/documentSources/MatchDocumentSource.js
  27. 1 0
      lib/pipeline/documentSources/ProjectDocumentSource.js
  28. 1 0
      lib/pipeline/documentSources/SkipDocumentSource.js
  29. 1 0
      lib/pipeline/documentSources/SortDocumentSource.js
  30. 1 0
      lib/pipeline/documentSources/SplitDocumentSource.js
  31. 7 6
      lib/pipeline/expressions/AddExpression.js
  32. 7 6
      lib/pipeline/expressions/AndExpression.js
  33. 4 3
      lib/pipeline/expressions/CoerceToBoolExpression.js
  34. 13 12
      lib/pipeline/expressions/CompareExpression.js
  35. 7 5
      lib/pipeline/expressions/CondExpression.js
  36. 12 10
      lib/pipeline/expressions/ConstantExpression.js
  37. 7 6
      lib/pipeline/expressions/DayOfMonthExpression.js
  38. 7 6
      lib/pipeline/expressions/DayOfWeekExpression.js
  39. 7 6
      lib/pipeline/expressions/DayOfYearExpression.js
  40. 7 6
      lib/pipeline/expressions/DivideExpression.js
  41. 132 131
      lib/pipeline/expressions/Expression.js
  42. 23 22
      lib/pipeline/expressions/FieldPathExpression.js
  43. 40 38
      lib/pipeline/expressions/FieldRangeExpression.js
  44. 7 5
      lib/pipeline/expressions/HourExpression.js
  45. 7 5
      lib/pipeline/expressions/IfNullExpression.js
  46. 7 6
      lib/pipeline/expressions/IndexOfExpression.js
  47. 7 5
      lib/pipeline/expressions/MinuteExpression.js
  48. 7 5
      lib/pipeline/expressions/ModExpression.js
  49. 7 6
      lib/pipeline/expressions/MonthExpression.js
  50. 7 5
      lib/pipeline/expressions/MultiplyExpression.js
  51. 25 25
      lib/pipeline/expressions/NaryExpression.js
  52. 9 8
      lib/pipeline/expressions/NotExpression.js
  53. 51 51
      lib/pipeline/expressions/ObjectExpression.js
  54. 5 5
      lib/pipeline/expressions/OrExpression.js
  55. 6 6
      lib/pipeline/expressions/SecondExpression.js
  56. 2 2
      lib/pipeline/expressions/StrcasecmpExpression.js
  57. 2 2
      lib/pipeline/expressions/SubstrExpression.js
  58. 2 2
      lib/pipeline/expressions/SubtractExpression.js
  59. 2 2
      lib/pipeline/expressions/ToLowerExpression.js
  60. 2 2
      lib/pipeline/expressions/ToUpperExpression.js
  61. 9 8
      lib/pipeline/expressions/WeekExpression.js
  62. 6 6
      lib/pipeline/expressions/YearExpression.js
  63. 0 1
      munge.js
  64. 1 0
      mungedb-aggregate.js
  65. 1 1
      package.json
  66. 2 1
      test/lib/Cursor.js
  67. 47 46
      test/lib/aggregate.js
  68. 2 0
      test/lib/pipeline/FieldPath.js
  69. 2 2
      test/lib/pipeline/Pipeline.js
  70. 2 2
      test/lib/pipeline/PipelineD.js
  71. 3 0
      test/lib/pipeline/accumulators/AddToSetAccumulator.js
  72. 1 1
      test/lib/pipeline/accumulators/AvgAccumulator.js
  73. 3 1
      test/lib/pipeline/accumulators/FirstAccumulator.js
  74. 1 0
      test/lib/pipeline/accumulators/LastAccumulator.js
  75. 3 1
      test/lib/pipeline/accumulators/MaxAccumulator.js
  76. 3 1
      test/lib/pipeline/accumulators/MinAccumulator.js
  77. 1 2
      test/lib/pipeline/accumulators/PushAccumulator.js
  78. 2 0
      test/lib/pipeline/accumulators/SingleValueAccumulator.js
  79. 1 1
      test/lib/pipeline/accumulators/SumAccumulator.js
  80. 3 1
      test/lib/pipeline/documentSources/CursorDocumentSource.js
  81. 1 6
      test/lib/pipeline/documentSources/FilterBaseDocumentSource.js
  82. 2 3
      test/lib/pipeline/documentSources/GroupDocumentSource.js
  83. 2 1
      test/lib/pipeline/documentSources/LimitDocumentSource.js
  84. 2 1
      test/lib/pipeline/documentSources/MatchDocumentSource.js
  85. 7 5
      test/lib/pipeline/documentSources/ProjectDocumentSource.js
  86. 2 1
      test/lib/pipeline/documentSources/SkipDocumentSource.js
  87. 2 1
      test/lib/pipeline/documentSources/SortDocumentSource.js
  88. 1 0
      test/lib/pipeline/documentSources/SplitDocumentSource.js
  89. 7 5
      test/lib/pipeline/documentSources/UnwindDocumentSource.js
  90. 3 1
      test/lib/pipeline/expressions/AddExpression.js
  91. 3 1
      test/lib/pipeline/expressions/AndExpression.js
  92. 2 0
      test/lib/pipeline/expressions/CoerceToBoolExpression.js
  93. 3 1
      test/lib/pipeline/expressions/CompareExpression.js
  94. 2 0
      test/lib/pipeline/expressions/CondExpression.js
  95. 3 1
      test/lib/pipeline/expressions/ConstantExpression.js
  96. 3 1
      test/lib/pipeline/expressions/DayOfMonthExpression.js
  97. 3 1
      test/lib/pipeline/expressions/DayOfWeekExpression.js
  98. 2 0
      test/lib/pipeline/expressions/DayOfYearExpression.js
  99. 2 0
      test/lib/pipeline/expressions/FieldPathExpression.js
  100. 2 0
      test/lib/pipeline/expressions/FieldRangeExpression.js

+ 0 - 1
index.js

@@ -1 +0,0 @@
-module.exports = require("./munge");

+ 4 - 11
lib/munge.js → lib/Aggregator.js

@@ -1,10 +1,11 @@
+"use strict";
 var PipelineCommand = require('./commands/PipelineCommand');
 var PipelineCommand = require('./commands/PipelineCommand');
 
 
-var Munger = (function(){
+var Aggregator = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
-	var base = Object, proto, klass = function Munger(ops){
+	var base = Object, proto, klass = function Aggregator(ops){
 		if (!ops){
 		if (!ops){
-			throw new Error("munge requires a pipeline!");
+			throw new Error("mungedb Aggregator requires a pipeline!");
 		}
 		}
 		if (typeof ops.length !== "number"){
 		if (typeof ops.length !== "number"){
 			ops = [ops];
 			ops = [ops];
@@ -23,11 +24,3 @@ var Munger = (function(){
 
 
 	return klass;
 	return klass;
 })();
 })();
-
-
-module.exports = function munge(ops, inputs) {
-	var munger = new Munger(ops);
-	if(inputs)
-		return munger.execute(inputs);
-	return munger.execute.bind(munger);
-};

+ 2 - 4
lib/Cursor.js

@@ -1,3 +1,4 @@
+"use strict";
 var Cursor = module.exports = (function(){
 var Cursor = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/**
 	/**
@@ -33,7 +34,6 @@ var Cursor = module.exports = (function(){
 	
 	
 	var su = require("stream-utils");
 	var su = require("stream-utils");
 
 
-
 	proto.ok = function ok(){
 	proto.ok = function ok(){
 		if (this.throughStream && this.throughStream.readable){
 		if (this.throughStream && this.throughStream.readable){
 			return true;
 			return true;
@@ -41,7 +41,6 @@ var Cursor = module.exports = (function(){
 		return this.cachedData.length > 0 || this.hasOwnProperty("curr");
 		return this.cachedData.length > 0 || this.hasOwnProperty("curr");
 	};
 	};
 
 
-
 	proto.advance = function advance(){
 	proto.advance = function advance(){
 		if (this.cachedData.length === 0){
 		if (this.cachedData.length === 0){
 			delete this.curr;
 			delete this.curr;
@@ -65,6 +64,5 @@ var Cursor = module.exports = (function(){
 		return this.curr;
 		return this.curr;
 	};
 	};
 	
 	
-	
 	return klass;
 	return klass;
-})();
+})();

+ 17 - 7
lib/commands/PipelineCommand.js

@@ -1,8 +1,16 @@
+"use strict";
 var PipelineCommand = module.exports = (function(){
 var PipelineCommand = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
+	/**
+	 * Represents a Pipeline Command
+	 *
+	 * @class PipelineCommand
+	 * @namespace mungedb.aggregate.pipeline
+	 * @module mungedb-aggregate
+	 * @constructor
+	 **/
 	var klass = function PipelineCommand(cmdObj){
 	var klass = function PipelineCommand(cmdObj){
         /* try to parse the command; if this fails, then we didn't run */
         /* try to parse the command; if this fails, then we didn't run */
-        
         //NOTE: this is different from the mongo implementation.  It used to be in the 'run' method that we would parse the pipeline, 
         //NOTE: this is different from the mongo implementation.  It used to be in the 'run' method that we would parse the pipeline, 
         //but we decided it would be better to be able to save the parsed command
         //but we decided it would be better to be able to save the parsed command
         this.pPipeline = Pipeline.parseCommand(cmdObj);
         this.pPipeline = Pipeline.parseCommand(cmdObj);
@@ -13,15 +21,16 @@ var PipelineCommand = module.exports = (function(){
 
 
 	/**
 	/**
 	 * Execute the pipeline.
 	 * Execute the pipeline.
-	**/
+	 * @method executePipeline
+	 **/
 	proto.executePipeline = function executePipeline(result, pPipeline, pSource){
 	proto.executePipeline = function executePipeline(result, pPipeline, pSource){
 		return pPipeline.run(result, pSource);
 		return pPipeline.run(result, pSource);
 	};
 	};
 	
 	
 	/**
 	/**
-	 * Documents are retrieved until the
-	 * cursor is exhausted (or another termination condition occurs).
-	**/
+	 * Documents are retrieved until the cursor is exhausted (or another termination condition occurs).
+	 * @method runExecute
+	 **/
 	proto.runExecute = function runExecute(result, db){
 	proto.runExecute = function runExecute(result, db){
 		var pSource = PipelineD.prepareCursorSource(this.pPipeline, db);
 		var pSource = PipelineD.prepareCursorSource(this.pPipeline, db);
         return this.executePipeline(result, this.pPipeline, pSource);
         return this.executePipeline(result, this.pPipeline, pSource);
@@ -29,7 +38,8 @@ var PipelineCommand = module.exports = (function(){
 	
 	
 	/**
 	/**
 	 * run the command
 	 * run the command
-	**/
+	 * @method run
+	 **/
 	proto.run = function run(db, result){
 	proto.run = function run(db, result){
 		if (!this.pPipeline){
 		if (!this.pPipeline){
 			return false;
 			return false;
@@ -38,4 +48,4 @@ var PipelineCommand = module.exports = (function(){
 	};
 	};
 
 
 	return klass;
 	return klass;
-})();
+})();

+ 13 - 0
lib/index.js

@@ -0,0 +1,13 @@
+"use strict";
+var Aggregator = require("./Aggregator");
+
+module.exports = (function(){
+	function aggregate(ops, inputs) {
+		var aggregator = new Aggregator(ops);
+		if(inputs)
+			return aggregator.execute(inputs);
+		return aggregator.execute.bind(aggregator);
+	}
+	aggregate.Aggregator = Aggregator;
+	return aggregate;
+})();

+ 30 - 22
lib/pipeline/Document.js

@@ -1,13 +1,14 @@
+"use strict";
 var Document = module.exports = (function(){
 var Document = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/**
 	/**
-	* Represents a `Document` (i.e., an `Object`) in `mongo` but in `munge` this is only a set of static helpers since we treat all `Object`s like `Document`s.
-	*
-	* @class Document
-	* @namespace munge.pipeline
-	* @module munge
-	* @constructor
-	**/
+	 * Represents a `Document` (i.e., an `Object`) in `mongo` but in `munge` this is only a set of static helpers since we treat all `Object`s like `Document`s.
+	 *
+	 * @class Document
+	 * @namespace mungedb.aggregate.pipeline
+	 * @module mungedb-aggregate
+	 * @constructor
+	 **/
 	var klass = function Document(){
 	var klass = function Document(){
 		if(this.constructor == Document) throw new Error("Never create instances! Use static helpers only.");
 		if(this.constructor == Document) throw new Error("Never create instances! Use static helpers only.");
 	}, base = Object, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
 	}, base = Object, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
@@ -17,24 +18,24 @@ var Document = module.exports = (function(){
 
 
 	// STATIC MEMBERS
 	// STATIC MEMBERS
 	/**
 	/**
-	* Shared "_id"
-	*
-	* @static
-	* @property ID_PROPERTY_NAME
-	**/
+	 * Shared "_id"
+	 * @static
+	 * @property ID_PROPERTY_NAME
+	 **/
 	klass.ID_PROPERTY_NAME = "_id";
 	klass.ID_PROPERTY_NAME = "_id";
 
 
 	/**
 	/**
-	* Compare two documents.
-	* BSON document field order is significant, so this just goes through the fields in order.
-	* The comparison is done in roughly the same way as strings are compared, but comparing one field at a time instead of one character at a time.
-	*
-	* @static
-	* @method compare
-	* @param rL left document
-	* @param rR right document
-	* @returns an integer less than zero, zero, or an integer greater than zero, depending on whether rL < rR, rL == rR, or rL > rR
-	**/
+	 * Compare two documents.
+	 *
+	 * BSON document field order is significant, so this just goes through the fields in order.
+	 * The comparison is done in roughly the same way as strings are compared, but comparing one field at a time instead of one character at a time.
+	 *
+	 * @static
+	 * @method compare
+	 * @param rL left document
+	 * @param rR right document
+	 * @returns an integer less than zero, zero, or an integer greater than zero, depending on whether rL < rR, rL == rR, or rL > rR
+	 **/
 	klass.compare = function compare(l, r){	//TODO: might be able to replace this with a straight compare of docs using JSON.stringify()
 	klass.compare = function compare(l, r){	//TODO: might be able to replace this with a straight compare of docs using JSON.stringify()
 		var lPropNames = Object.getOwnPropertyNames(l),
 		var lPropNames = Object.getOwnPropertyNames(l),
 			lPropNamesLength = lPropNames.length,
 			lPropNamesLength = lPropNames.length,
@@ -61,6 +62,13 @@ var Document = module.exports = (function(){
 		throw new Error("This should never happen");	//verify(false)
 		throw new Error("This should never happen");	//verify(false)
 //		return 0;
 //		return 0;
 	};
 	};
+
+	/**
+	 * Clone a document
+	 * @static
+	 * @method clone
+	 * @param document
+	 **/
 	klass.clone = function(document){
 	klass.clone = function(document){
 		var obj = {};
 		var obj = {};
 		for(var key in document){
 		for(var key in document){

+ 33 - 33
lib/pipeline/FieldPath.js

@@ -1,17 +1,18 @@
+"use strict";
 var FieldPath = module.exports = FieldPath = (function(){
 var FieldPath = module.exports = FieldPath = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/**
 	/**
-	* Constructor for field paths.
-	*
-	* The constructed object will have getPathLength() > 0.
-	* Uassert if any component field names do not pass validation.
-	*
-	* @class FieldPath
-	* @namespace munge.pipeline
-	* @module munge
-	* @constructor
-	* @param fieldPath the dotted field path string or non empty pre-split vector.
-	**/
+	 * Constructor for field paths.
+	 *
+	 * The constructed object will have getPathLength() > 0.
+	 * Uassert if any component field names do not pass validation.
+	 *
+	 * @class FieldPath
+	 * @namespace mungedb.aggregate.pipeline
+	 * @module mungedb-aggregate
+	 * @constructor
+	 * @param fieldPath the dotted field path string or non empty pre-split vector.
+	 **/
 	var klass = function FieldPath(path){
 	var klass = function FieldPath(path){
 		var fields = typeof(path) === "object" && typeof(path.length) === "number" ? path : path.split(".");
 		var fields = typeof(path) === "object" && typeof(path.length) === "number" ? path : path.split(".");
 		if(fields.length === 0) throw new Error("FieldPath cannot be constructed from an empty vector (String or Array).; code 16409");
 		if(fields.length === 0) throw new Error("FieldPath cannot be constructed from an empty vector (String or Array).; code 16409");
@@ -31,46 +32,45 @@ var FieldPath = module.exports = FieldPath = (function(){
 
 
 	// PROTOTYPE MEMBERS
 	// PROTOTYPE MEMBERS
 	/**
 	/**
-	* Get the full path.
-	*
-	* @method getPath
-	* @param fieldPrefix whether or not to include the field prefix
-	* @returns the complete field path
-	*/
+	 * Get the full path.
+	 *
+	 * @method getPath
+	 * @param fieldPrefix whether or not to include the field prefix
+	 * @returns the complete field path
+	 **/
 	proto.getPath = function getPath(withPrefix) {
 	proto.getPath = function getPath(withPrefix) {
 		return ( !! withPrefix ? FieldPath.PREFIX : "") + this.fields.join(".");
 		return ( !! withPrefix ? FieldPath.PREFIX : "") + this.fields.join(".");
 	};
 	};
 
 
 	/**
 	/**
-	* A FieldPath like this but missing the first element (useful for recursion). Precondition getPathLength() > 1.
-	*
-	* @method tail
-	**/
+	 * A FieldPath like this but missing the first element (useful for recursion). Precondition getPathLength() > 1.
+	 *
+	 * @method tail
+	 **/
 	proto.tail = function tail() {
 	proto.tail = function tail() {
 		return new FieldPath(this.fields.slice(1));
 		return new FieldPath(this.fields.slice(1));
 	};
 	};
 
 
 	/**
 	/**
-	* Get a particular path element from the path.
-	*
-	* @method getFieldName
-	* @param i the zero based index of the path element.
-	* @returns the path element
-	*/
+	 * Get a particular path element from the path.
+	 *
+	 * @method getFieldName
+	 * @param i the zero based index of the path element.
+	 * @returns the path element
+	 **/
 	proto.getFieldName = function getFieldName(i){	//TODO: eventually replace this with just using .fields[i] directly
 	proto.getFieldName = function getFieldName(i){	//TODO: eventually replace this with just using .fields[i] directly
 		return this.fields[i];
 		return this.fields[i];
 	};
 	};
 
 
 	/**
 	/**
-	* Get the number of path elements in the field path.
-	*
-	* @method getPathLength
-	* @returns the number of path elements
-	**/
+	 * Get the number of path elements in the field path.
+	 *
+	 * @method getPathLength
+	 * @returns the number of path elements
+	 **/
 	proto.getPathLength = function getPathLength() {
 	proto.getPathLength = function getPathLength() {
 		return this.fields.length;
 		return this.fields.length;
 	};
 	};
 
 
-
 	return klass;
 	return klass;
 })();
 })();

+ 8 - 7
lib/pipeline/Pipeline.js

@@ -1,13 +1,13 @@
+"use strict";
 var Pipeline = module.exports = (function(){
 var Pipeline = module.exports = (function(){
-	// CONSTRUCTOR
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/**
 	/**
-	* mongodb "commands" (sent via db.$cmd.findOne(...)) subclass to make a command.  define a singleton object for it.
-	* @class Pipeline
-	* @namespace munge.pipeline
-	* @module munge
-	* @constructor
-	**/
+	 * mongodb "commands" (sent via db.$cmd.findOne(...)) subclass to make a command.  define a singleton object for it.
+	 * @class Pipeline
+	 * @namespace mungedb.aggregate.pipeline
+	 * @module mungedb-aggregate
+	 * @constructor
+	 **/
 	var klass = function Pipeline(/*theCtx*/){
 	var klass = function Pipeline(/*theCtx*/){
 		this.sourceVector = [];//should be provate?
 		this.sourceVector = [];//should be provate?
 	}, base = Object, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
 	}, base = Object, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
@@ -138,6 +138,7 @@ var Pipeline = module.exports = (function(){
 
 
 		return pipelineInstance;
 		return pipelineInstance;
 	};
 	};
+
 	/**
 	/**
 	 * Run the pipeline
 	 * Run the pipeline
 	 *
 	 *

+ 1 - 0
lib/pipeline/PipelineD.js

@@ -1,3 +1,4 @@
+"use strict";
 var PipelineD = module.exports = (function(){
 var PipelineD = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	var klass = function PipelineD(){
 	var klass = function PipelineD(){

+ 18 - 16
lib/pipeline/Value.js

@@ -1,14 +1,14 @@
+"use strict";
 var Value = module.exports = Value = (function(){
 var Value = module.exports = Value = (function(){
-
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/**
 	/**
-	* Represents a `Value` (i.e., an `Object`) in `mongo` but in `munge` this is only a set of static helpers since we treat all `Object`s like `Value`s.
-	*
-	* @class Value
-	* @namespace munge.pipeline
-	* @module munge
-	* @constructor
-	**/
+	 * Represents a `Value` (i.e., an `Object`) in `mongo` but in `munge` this is only a set of static helpers since we treat all `Object`s like `Value`s.
+	 *
+	 * @class Value
+	 * @namespace mungedb.aggregate.pipeline
+	 * @module mungedb-aggregate
+	 * @constructor
+	 **/
 	var klass = function Value(){
 	var klass = function Value(){
 		if(this.constructor == Value) throw new Error("Never create instances of this! Use the static helpers only.");
 		if(this.constructor == Value) throw new Error("Never create instances of this! Use the static helpers only.");
 	}, base = Object, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
 	}, base = Object, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
@@ -74,14 +74,15 @@ var Value = module.exports = Value = (function(){
 //TODO:	klass.coerceToTimestamp = ...?
 //TODO:	klass.coerceToTimestamp = ...?
 
 
 	/**
 	/**
-	* Compare two Values.
-	*
-	* @static
-	* @method compare
-	* @param rL left value
-	* @param rR right value
-	* @returns an integer less than zero, zero, or an integer greater than zero, depending on whether rL < rR, rL == rR, or rL > rR
-	**/
+	 * Compare two Values.
+	 *
+	 * @static
+	 * @method compare
+	 * @param rL left value
+	 * @param rR right value
+	 * @returns an integer less than zero, zero, or an integer greater than zero, depending on whether rL < rR, rL == rR, or rL > rR
+	 **/
+	var Document;  // loaded lazily below //TODO: a dirty hack; need to investigate and clean up
 	klass.compare = function compare(l, r) {
 	klass.compare = function compare(l, r) {
 		var lt = typeof(l),
 		var lt = typeof(l),
 			rt = typeof(r);
 			rt = typeof(r);
@@ -134,6 +135,7 @@ var Value = module.exports = Value = (function(){
 			}
 			}
 			if (l instanceof Date) return l < r ? -1 : l > r ? 1 : 0;
 			if (l instanceof Date) return l < r ? -1 : l > r ? 1 : 0;
 			if (l instanceof RegExp) return l < r ? -1 : l > r ? 1 : 0;
 			if (l instanceof RegExp) return l < r ? -1 : l > r ? 1 : 0;
+			if(Document === undefined) Document = require("./Document");	//TODO: a dirty hack; need to investigate and clean up
 			return Document.compare(l, r);
 			return Document.compare(l, r);
 		default:
 		default:
 			throw new Error("unhandled left hand type:" + lt);
 			throw new Error("unhandled left hand type:" + lt);

+ 10 - 9
lib/pipeline/accumulators/Accumulator.js

@@ -1,3 +1,4 @@
+"use strict";
 var Accumulator = module.exports = (function(){
 var Accumulator = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/** 
 	/** 
@@ -42,12 +43,12 @@ var Accumulator = module.exports = (function(){
 	*   @param {String} opName the operator name
 	*   @param {String} opName the operator name
 	*   @param {Boolean} requireExpression pass down if the expression is needed
 	*   @param {Boolean} requireExpression pass down if the expression is needed
 	**/
 	**/
-	proto.opToBson = function opToBson(pBuilder, opName, fieldName, requireExpression) {
-		if (this.operands.length == 1) throw new Error("this should never happen");
-		var builder = new BSONObjBuilder();
-		this.operands[0].addToBsonObj(builder, opName, requireExpression);
-		pBuilder.append(fieldName, builder.done());
-	};
+//	proto.opToBson = function opToBson(pBuilder, opName, fieldName, requireExpression) {
+//		if (this.operands.length == 1) throw new Error("this should never happen");
+//		var builder = new BSONObjBuilder();
+//		this.operands[0].addToBsonObj(builder, opName, requireExpression);
+//		pBuilder.append(fieldName, builder.done());
+//	};
 
 
 	/**
 	/**
 	*   Wrapper around opToBson
 	*   Wrapper around opToBson
@@ -56,9 +57,9 @@ var Accumulator = module.exports = (function(){
 	*   @param {String} fieldName the projected name
 	*   @param {String} fieldName the projected name
 	*   @param {Boolean} requireExpression pass down if the expression is needed
 	*   @param {Boolean} requireExpression pass down if the expression is needed
 	**/
 	**/
-	proto.addToBsonObj = function addToBsonObj(pBuilder, fieldName, requireExpression) {
-		this.opToBson(pBuilder, this.getOpName(), fieldName, requireExpression);
-	};
+//	proto.addToBsonObj = function addToBsonObj(pBuilder, fieldName, requireExpression) {
+//		this.opToBson(pBuilder, this.getOpName(), fieldName, requireExpression);
+//	};
 
 
 	/**
 	/**
 	*   Make sure that nobody adds an accumulator to an array
 	*   Make sure that nobody adds an accumulator to an array

+ 1 - 0
lib/pipeline/accumulators/AddToSetAccumulator.js

@@ -1,3 +1,4 @@
+"use strict";
 var AddToSetAccumulator = module.exports = (function(){
 var AddToSetAccumulator = module.exports = (function(){
 
 
 	// DEPENDENCIES
 	// DEPENDENCIES

+ 1 - 0
lib/pipeline/accumulators/AvgAccumulator.js

@@ -1,3 +1,4 @@
+"use strict";
 var AvgAccumulator = module.exports = (function(){
 var AvgAccumulator = module.exports = (function(){
 
 
 	// Constructor
 	// Constructor

+ 1 - 0
lib/pipeline/accumulators/FirstAccumulator.js

@@ -1,3 +1,4 @@
+"use strict";
 var FirstAccumulator = module.exports = (function(){
 var FirstAccumulator = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/** 
 	/** 

+ 1 - 0
lib/pipeline/accumulators/LastAccumulator.js

@@ -1,3 +1,4 @@
+"use strict";
 var LastAccumulator = module.exports = (function(){
 var LastAccumulator = module.exports = (function(){
 
 
 	// Constructor
 	// Constructor

+ 1 - 0
lib/pipeline/accumulators/MinMaxAccumulator.js

@@ -1,3 +1,4 @@
+"use strict";
 var MinMaxAccumulator = module.exports = (function(){
 var MinMaxAccumulator = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/** 
 	/** 

+ 1 - 0
lib/pipeline/accumulators/PushAccumulator.js

@@ -1,3 +1,4 @@
+"use strict";
 var PushAccumulator = module.exports = (function(){
 var PushAccumulator = module.exports = (function(){
 
 
 	// Constructor
 	// Constructor

+ 1 - 0
lib/pipeline/accumulators/SingleValueAccumulator.js

@@ -1,3 +1,4 @@
+"use strict";
 var SingleValueAccumulator = module.exports = (function(){
 var SingleValueAccumulator = module.exports = (function(){
 
 
 	// Constructor
 	// Constructor

+ 1 - 0
lib/pipeline/accumulators/SumAccumulator.js

@@ -1,3 +1,4 @@
+"use strict";
 var SumAccumulator = module.exports = (function(){
 var SumAccumulator = module.exports = (function(){
 
 
 	// Constructor
 	// Constructor

+ 8 - 7
lib/pipeline/accumulators/index.js

@@ -1,11 +1,12 @@
+"use strict";
 module.exports = {
 module.exports = {
-	AddToSet:require("./AddToSetAccumulator"),
-	Avg:require("./AvgAccumulator"),
-	First:require("./FirstAccumulator"),
-	Last:require("./LastAccumulator"),
-	MinMax:require("./MinMaxAccumulator"),
-	Push:require("./PushAccumulator"),
-	Sum:require("./SumAccumulator")
+	AddToSet: require("./AddToSetAccumulator"),
+	Avg: require("./AvgAccumulator"),
+	First: require("./FirstAccumulator"),
+	Last: require("./LastAccumulator"),
+	MinMax: require("./MinMaxAccumulator"),
+	Push: require("./PushAccumulator"),
+	Sum: require("./SumAccumulator")
 };
 };
 
 
 
 

+ 1 - 0
lib/pipeline/documentSources/CursorDocumentSource.js

@@ -1,3 +1,4 @@
+"use strict";
 var CursorDocumentSource = module.exports = (function(){
 var CursorDocumentSource = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
     /**
     /**

+ 1 - 0
lib/pipeline/documentSources/DocumentSource.js

@@ -1,3 +1,4 @@
+"use strict";
 var DocumentSource = module.exports = (function(){
 var DocumentSource = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/**
 	/**

+ 1 - 0
lib/pipeline/documentSources/FilterBaseDocumentSource.js

@@ -1,3 +1,4 @@
+"use strict";
 var FilterBaseDocumentSource = module.exports = (function(){
 var FilterBaseDocumentSource = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/**
 	/**

+ 5 - 2
lib/pipeline/documentSources/GroupDocumentSource.js

@@ -1,10 +1,13 @@
+"use strict";
 var DocumentSource = require("./DocumentSource"),
 var DocumentSource = require("./DocumentSource"),
 	Accumulators = require("../accumulators/"),
 	Accumulators = require("../accumulators/"),
 	Document = require("../Document"),
 	Document = require("../Document"),
 	Expression = require("../expressions/Expression"),
 	Expression = require("../expressions/Expression"),
 	ConstantExpression = require("../expressions/ConstantExpression"),
 	ConstantExpression = require("../expressions/ConstantExpression"),
-	FieldPathExpression = require("../expressions/FieldPathExpression"),
-	GroupDocumentSource = module.exports = (function(){
+	FieldPathExpression = require("../expressions/FieldPathExpression");
+
+
+var GroupDocumentSource = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/**
 	/**
 	 * A class for grouping documents together
 	 * A class for grouping documents together

+ 1 - 0
lib/pipeline/documentSources/LimitDocumentSource.js

@@ -1,3 +1,4 @@
+"use strict";
 var LimitDocumentSource = module.exports = (function(){
 var LimitDocumentSource = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/**
 	/**

+ 1 - 0
lib/pipeline/documentSources/MatchDocumentSource.js

@@ -1,3 +1,4 @@
+"use strict";
 var MatchDocumentSource = module.exports = (function(){
 var MatchDocumentSource = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/**
 	/**

+ 1 - 0
lib/pipeline/documentSources/ProjectDocumentSource.js

@@ -1,3 +1,4 @@
+"use strict";
 var ProjectDocumentSource = module.exports = (function(){
 var ProjectDocumentSource = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/**
 	/**

+ 1 - 0
lib/pipeline/documentSources/SkipDocumentSource.js

@@ -1,3 +1,4 @@
+"use strict";
 var SkipDocumentSource = module.exports = (function(){
 var SkipDocumentSource = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/**
 	/**

+ 1 - 0
lib/pipeline/documentSources/SortDocumentSource.js

@@ -1,3 +1,4 @@
+"use strict";
 var SortDocumentSource = module.exports = (function(){
 var SortDocumentSource = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/**
 	/**

+ 1 - 0
lib/pipeline/documentSources/SplitDocumentSource.js

@@ -1,3 +1,4 @@
+"use strict";
 var SplitDocumentSource = module.exports = (function(){
 var SplitDocumentSource = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/**
 	/**

+ 7 - 6
lib/pipeline/expressions/AddExpression.js

@@ -1,13 +1,14 @@
+"use strict";
 var AddExpression = module.exports = (function(){
 var AddExpression = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/** 
 	/** 
 	 * Create an expression that finds the sum of n operands. 
 	 * Create an expression that finds the sum of n operands. 
 	 *
 	 *
 	 * @class AddExpression
 	 * @class AddExpression
-	 * @namespace munge.pipeline.expressions
-	 * @module munge
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
 	 * @constructor
 	 * @constructor
-	**/
+	 **/
 	var klass = module.exports = function AddExpression(){
 	var klass = module.exports = function AddExpression(){
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		base.call(this);
 		base.call(this);
@@ -26,9 +27,9 @@ var AddExpression = module.exports = (function(){
 	};
 	};
 
 
 	/**
 	/**
-	* Takes an array of one or more numbers and adds them together, returning the sum.
-	* @method @evaluate
-	**/
+	 * Takes an array of one or more numbers and adds them together, returning the sum.
+	 * @method @evaluate
+	 **/
 	proto.evaluate = function evaluate(doc) {
 	proto.evaluate = function evaluate(doc) {
 		var total = 0;
 		var total = 0;
 		for (var i = 0, n = this.operands.length; i < n; ++i) {
 		for (var i = 0, n = this.operands.length; i < n; ++i) {

+ 7 - 6
lib/pipeline/expressions/AndExpression.js

@@ -1,3 +1,4 @@
+"use strict";
 var AndExpression = module.exports = (function(){
 var AndExpression = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/** 
 	/** 
@@ -7,10 +8,10 @@ var AndExpression = module.exports = (function(){
 	 * returns false on the first operand that evaluates to false.
 	 * returns false on the first operand that evaluates to false.
 	 *
 	 *
 	 * @class AndExpression
 	 * @class AndExpression
-	 * @namespace munge.pipeline.expressions
-	 * @module munge
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
 	 * @constructor
 	 * @constructor
-	**/
+	 **/
 	var klass = module.exports = function AndExpression(){
 	var klass = module.exports = function AndExpression(){
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		base.call(this);
 		base.call(this);
@@ -31,9 +32,9 @@ var AndExpression = module.exports = (function(){
 	};
 	};
 
 
 	/**
 	/**
-	* Takes an array one or more values and returns true if all of the values in the array are true. Otherwise $and returns false.
-	* @method evaluate
-	**/
+	 * Takes an array one or more values and returns true if all of the values in the array are true. Otherwise $and returns false.
+	 * @method evaluate
+	 **/
 	proto.evaluate = function evaluate(doc) {
 	proto.evaluate = function evaluate(doc) {
 		for (var i = 0, n = this.operands.length; i < n; ++i) {
 		for (var i = 0, n = this.operands.length; i < n; ++i) {
 			var value = this.operands[i].evaluate(doc);
 			var value = this.operands[i].evaluate(doc);

+ 4 - 3
lib/pipeline/expressions/CoerceToBoolExpression.js

@@ -1,13 +1,14 @@
+"use strict";
 var CoerceToBoolExpression = module.exports = (function(){
 var CoerceToBoolExpression = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/** 
 	/** 
 	 * internal expression for coercing things to booleans 
 	 * internal expression for coercing things to booleans 
 	 *
 	 *
 	 * @class CoerceToBoolExpression
 	 * @class CoerceToBoolExpression
-	 * @namespace munge.pipeline.expressions
-	 * @module munge
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
 	 * @constructor
 	 * @constructor
-	**/
+	 **/
 	var klass = module.exports = function CoerceToBoolExpression(expression){
 	var klass = module.exports = function CoerceToBoolExpression(expression){
 		if(arguments.length !== 1) throw new Error("args expected: expression");
 		if(arguments.length !== 1) throw new Error("args expected: expression");
 		this.expression = expression;
 		this.expression = expression;

+ 13 - 12
lib/pipeline/expressions/CompareExpression.js

@@ -1,13 +1,14 @@
+"use strict";
 var CompareExpression = module.exports = (function(){
 var CompareExpression = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/**
 	/**
 	 * Generic comparison expression that gets used for $eq, $ne, $lt, $lte, $gt, $gte, and $cmp. 
 	 * Generic comparison expression that gets used for $eq, $ne, $lt, $lte, $gt, $gte, and $cmp. 
 	 *
 	 *
 	 * @class CompareExpression
 	 * @class CompareExpression
-	 * @namespace munge.pipeline.expressions
-	 * @module munge
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
 	 * @constructor
 	 * @constructor
-	**/
+	 **/
 	var klass = module.exports = CompareExpression = function CompareExpression(cmpOp) {
 	var klass = module.exports = CompareExpression = function CompareExpression(cmpOp) {
 		if(arguments.length !== 1) throw new Error("args expected: cmpOp");
 		if(arguments.length !== 1) throw new Error("args expected: cmpOp");
 		this.cmpOp = cmpOp;
 		this.cmpOp = cmpOp;
@@ -23,12 +24,12 @@ var CompareExpression = module.exports = (function(){
 
 
 	// NESTED CLASSES
 	// NESTED CLASSES
 	/**
 	/**
-	* Lookup table for truth value returns
-	*
-	* @param truthValues	truth value for -1, 0, 1
-	* @param reverse		reverse comparison operator
-	* @param name			string name
-	**/
+	 * Lookup table for truth value returns
+	 *
+	 * @param truthValues	truth value for -1, 0, 1
+	 * @param reverse		reverse comparison operator
+	 * @param name			string name
+	 **/
 	var CmpLookup = (function(){	// emulating a struct
 	var CmpLookup = (function(){	// emulating a struct
 		// CONSTRUCTOR
 		// CONSTRUCTOR
 		var klass = function CmpLookup(truthValues, reverse, name) {
 		var klass = function CmpLookup(truthValues, reverse, name) {
@@ -42,9 +43,9 @@ var CompareExpression = module.exports = (function(){
 
 
 	// PRIVATE STATIC MEMBERS
 	// PRIVATE STATIC MEMBERS
 	/**
 	/**
-	* a table of cmp type lookups to truth values
-	* @private
-	**/
+	 * a table of cmp type lookups to truth values
+	 * @private
+	 **/
 	var cmpLookupMap = [	//NOTE: converted from this Array to a Dict/Object below using CmpLookup#name as the key
 	var cmpLookupMap = [	//NOTE: converted from this Array to a Dict/Object below using CmpLookup#name as the key
 		//              -1      0      1      reverse             name     (taking advantage of the fact that our 'enums' are strings below)
 		//              -1      0      1      reverse             name     (taking advantage of the fact that our 'enums' are strings below)
 		new CmpLookup([false, true, false], Expression.CmpOp.EQ, Expression.CmpOp.EQ),
 		new CmpLookup([false, true, false], Expression.CmpOp.EQ, Expression.CmpOp.EQ),

+ 7 - 5
lib/pipeline/expressions/CondExpression.js

@@ -1,3 +1,4 @@
+"use strict";
 var CondExpression = module.exports = (function(){
 var CondExpression = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/**
 	/**
@@ -6,10 +7,10 @@ var CondExpression = module.exports = (function(){
 	 * @see evaluate 
 	 * @see evaluate 
 	 *
 	 *
 	 * @class AndExpression
 	 * @class AndExpression
-	 * @namespace munge.pipeline.expressions
-	 * @module munge
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
 	 * @constructor
 	 * @constructor
-	**/
+	 **/
 	var klass = module.exports = function CondExpression(){
 	var klass = module.exports = function CondExpression(){
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		base.call(this);
 		base.call(this);
@@ -29,8 +30,9 @@ var CondExpression = module.exports = (function(){
 	};
 	};
 
 
 	/** 
 	/** 
-	* Use the $cond operator with the following syntax:  { $cond: [ <boolean-expression>, <true-case>, <false-case> ] } 
-	**/
+	 * Use the $cond operator with the following syntax:  { $cond: [ <boolean-expression>, <true-case>, <false-case> ] } 
+	 * @method evaluate
+	 **/
 	proto.evaluate = function evaluate(doc){
 	proto.evaluate = function evaluate(doc){
 		this.checkArgCount(3);
 		this.checkArgCount(3);
 		var pCond = this.operands[0].evaluate(doc),
 		var pCond = this.operands[0].evaluate(doc),

+ 12 - 10
lib/pipeline/expressions/ConstantExpression.js

@@ -1,13 +1,14 @@
+"use strict";
 var ConstantExpression = module.exports = (function(){
 var ConstantExpression = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/** 
 	/** 
 	 * Internal expression for constant values 
 	 * Internal expression for constant values 
 	 *
 	 *
 	 * @class ConstantExpression
 	 * @class ConstantExpression
-	 * @namespace munge.pipeline.expressions
-	 * @module munge
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
 	 * @constructor
 	 * @constructor
-	**/
+	 **/
 	var klass = function ConstantExpression(value){
 	var klass = function ConstantExpression(value){
 		if(arguments.length !== 1) throw new Error("args expected: value");
 		if(arguments.length !== 1) throw new Error("args expected: value");
 		this.value = value;	//TODO: actually make read-only in terms of JS?
 		this.value = value;	//TODO: actually make read-only in terms of JS?
@@ -20,10 +21,11 @@ var ConstantExpression = module.exports = (function(){
 	};
 	};
 
 
 	/**
 	/**
-	* Get the constant value represented by this Expression.
-	*
-	* @returns the value
-	**/
+	 * 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
 	proto.getValue = function getValue(){	//TODO: convert this to an instance field rather than a property
 		return this.value;
 		return this.value;
 	};
 	};
@@ -33,9 +35,9 @@ var ConstantExpression = module.exports = (function(){
 	};
 	};
 
 
 	/**
 	/**
-	* Get the constant value represented by this Expression.
-	* @method evaluate
-	**/
+	 * Get the constant value represented by this Expression.
+	 * @method evaluate
+	 **/
 	proto.evaluate = function evaluate(doc){
 	proto.evaluate = function evaluate(doc){
 		return this.value;
 		return this.value;
 	};
 	};

+ 7 - 6
lib/pipeline/expressions/DayOfMonthExpression.js

@@ -1,13 +1,14 @@
+"use strict";
 var DayOfMonthExpression = module.exports = (function(){
 var DayOfMonthExpression = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/**
 	/**
 	 * Get the DayOfMonth from a date.
 	 * Get the DayOfMonth from a date.
 	 *
 	 *
 	 * @class DayOfMonthExpression
 	 * @class DayOfMonthExpression
-	 * @namespace munge.pipeline.expressions
-	 * @module munge
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
 	 * @constructor
 	 * @constructor
-	**/
+	 **/
 	var klass = function DayOfMonthExpression(){
 	var klass = function DayOfMonthExpression(){
 		if (arguments.length !== 0) throw new Error("zero args expected");
 		if (arguments.length !== 0) throw new Error("zero args expected");
 		base.call(this);
 		base.call(this);
@@ -24,9 +25,9 @@ var DayOfMonthExpression = module.exports = (function(){
 	};
 	};
 
 
 	/**
 	/**
-	* Takes a date and returns the day of the month as a number between 1 and 31.
-	* @method evaluate
-	**/
+	 * Takes a date and returns the day of the month as a number between 1 and 31.
+	 * @method evaluate
+	 **/
 	proto.evaluate = function evaluate(doc){
 	proto.evaluate = function evaluate(doc){
 		this.checkArgCount(1);
 		this.checkArgCount(1);
 		var date = this.operands[0].evaluate(doc);
 		var date = this.operands[0].evaluate(doc);

+ 7 - 6
lib/pipeline/expressions/DayOfWeekExpression.js

@@ -1,13 +1,14 @@
+"use strict";
 var DayOfWeekExpression = module.exports = (function(){
 var DayOfWeekExpression = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/**
 	/**
 	 * Get the DayOfWeek from a date.
 	 * Get the DayOfWeek from a date.
 	 *
 	 *
 	 * @class DayOfWeekExpression
 	 * @class DayOfWeekExpression
-	 * @namespace munge.pipeline.expressions
-	 * @module munge
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
 	 * @constructor
 	 * @constructor
-	**/
+	 **/
 	var klass = function DayOfWeekExpression(){
 	var klass = function DayOfWeekExpression(){
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		base.call(this);
 		base.call(this);
@@ -24,9 +25,9 @@ var DayOfWeekExpression = module.exports = (function(){
 	};
 	};
 
 
 	/**
 	/**
-	* Takes a date and returns the day of the week as a number between 1 (Sunday) and 7 (Saturday.)
-	* @method evaluate
-	**/
+	 * Takes a date and returns the day of the week as a number between 1 (Sunday) and 7 (Saturday.)
+	 * @method evaluate
+	 **/
 	proto.evaluate = function evaluate(doc){
 	proto.evaluate = function evaluate(doc){
 		this.checkArgCount(1);
 		this.checkArgCount(1);
 		var date = this.operands[0].evaluate(doc);
 		var date = this.operands[0].evaluate(doc);

+ 7 - 6
lib/pipeline/expressions/DayOfYearExpression.js

@@ -1,13 +1,14 @@
+"use strict";
 var DayOfYearExpression = module.exports = (function(){
 var DayOfYearExpression = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/**
 	/**
 	 * Get the DayOfYear from a date.
 	 * Get the DayOfYear from a date.
 	 *
 	 *
 	 * @class DayOfYearExpression
 	 * @class DayOfYearExpression
-	 * @namespace munge.pipeline.expressions
-	 * @module munge
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
 	 * @constructor
 	 * @constructor
-	**/
+	 **/
 	var klass = function DayOfYearExpression(){
 	var klass = function DayOfYearExpression(){
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		base.call(this);
 		base.call(this);
@@ -24,9 +25,9 @@ var DayOfYearExpression = module.exports = (function(){
 	};
 	};
 
 
 	/**
 	/**
-	* Takes a date and returns the day of the year as a number between 1 and 366.
-	* @method evaluate
-	**/
+	 * Takes a date and returns the day of the year as a number between 1 and 366.
+	 * @method evaluate
+	 **/
 	proto.evaluate = function evaluate(doc){
 	proto.evaluate = function evaluate(doc){
 		//NOTE: the below silliness is to deal with the leap year scenario when we should be returning 366
 		//NOTE: the below silliness is to deal with the leap year scenario when we should be returning 366
 		this.checkArgCount(1);
 		this.checkArgCount(1);

+ 7 - 6
lib/pipeline/expressions/DivideExpression.js

@@ -1,3 +1,4 @@
+"use strict";
 var DivideExpression = module.exports = (function(){
 var DivideExpression = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/** 
 	/** 
@@ -5,10 +6,10 @@ var DivideExpression = module.exports = (function(){
 	 *
 	 *
 	 * @see evaluate 
 	 * @see evaluate 
 	 * @class DivideExpression
 	 * @class DivideExpression
-	 * @namespace munge.pipeline.expressions
-	 * @module munge
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
 	 * @constructor
 	 * @constructor
-	**/
+	 **/
 	var klass = function DivideExpression(){
 	var klass = function DivideExpression(){
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		base.call(this);
 		base.call(this);
@@ -28,9 +29,9 @@ var DivideExpression = module.exports = (function(){
 	};
 	};
 
 
 	/**
 	/**
-	* Takes an array that contains a pair of numbers and returns the value of the first number divided by the second number.
-	* @method evaluate
-	**/
+	 * Takes an array that contains a pair of numbers and returns the value of the first number divided by the second number.
+	 * @method evaluate
+	 **/
 	proto.evaluate = function evaluate(doc) {
 	proto.evaluate = function evaluate(doc) {
 		this.checkArgCount(2);
 		this.checkArgCount(2);
 		var left = this.operands[0].evaluate(doc),
 		var left = this.operands[0].evaluate(doc),

+ 132 - 131
lib/pipeline/expressions/Expression.js

@@ -1,18 +1,19 @@
+"use strict";
 var Expression = module.exports = (function(){
 var Expression = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/**
 	/**
-	* A base class for all pipeline expressions; Performs common expressions within an Op.
-	*
-	* NOTE: An object expression can take any of the following forms:
-	*
-	*	f0: {f1: ..., f2: ..., f3: ...}
-	*	f0: {$operator:[operand1, operand2, ...]}
-	*
-	* @class Expression
-	* @namespace munge.pipeline.expressions
-	* @module munge
-	* @constructor
-	**/
+	 * A base class for all pipeline expressions; Performs common expressions within an Op.
+	 *
+	 * NOTE: An object expression can take any of the following forms:
+	 *
+	 *	f0: {f1: ..., f2: ..., f3: ...}
+	 *	f0: {$operator:[operand1, operand2, ...]}
+	 *
+	 * @class Expression
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
+	 * @constructor
+	 **/
 	var klass = module.exports = Expression = function Expression(){
 	var klass = module.exports = Expression = function Expression(){
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		if(arguments.length !== 0) throw new Error("zero args expected");
 	}, base = Object, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
 	}, base = Object, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
@@ -22,26 +23,26 @@ var Expression = module.exports = (function(){
 
 
 	// NESTED CLASSES
 	// NESTED CLASSES
 	/**
 	/**
-	* Reference to the `munge.pipeline.expressions.Expression.ObjectCtx` class
-	* @static
-	* @property ObjectCtx
-	**/
+	 * Reference to the `munge.pipeline.expressions.Expression.ObjectCtx` class
+	 * @static
+	 * @property ObjectCtx
+	 **/
 	var ObjectCtx = Expression.ObjectCtx = (function(){
 	var ObjectCtx = Expression.ObjectCtx = (function(){
 		// CONSTRUCTOR
 		// CONSTRUCTOR
 		/**
 		/**
-		* Utility class for parseObject() below. isDocumentOk indicates that it is OK to use a Document in the current context.
-		*
-		* NOTE: deviation from Mongo code: accepts an `Object` of settings rather than a bitmask to help simplify the interface a little bit
-		*
-		* @class ObjectCtx
-		* @namespace munge.pipeline.expressions.Expression
-		* @module munge
-		* @constructor
-		* @param opts
-		*	@param [opts.isDocumentOk]	{Boolean}
-		*	@param [opts.isTopLevel]	{Boolean}
-		*	@param [opts.isInclusionOk]	{Boolean}
-		**/
+		 * Utility class for parseObject() below. isDocumentOk indicates that it is OK to use a Document in the current context.
+		 *
+		 * NOTE: deviation from Mongo code: accepts an `Object` of settings rather than a bitmask to help simplify the interface a little bit
+		 *
+		 * @class ObjectCtx
+		 * @namespace mungedb.aggregate.pipeline.expressions.Expression
+		 * @module mungedb-aggregate
+		 * @constructor
+		 * @param opts
+		 *	@param [opts.isDocumentOk]	{Boolean}
+		 *	@param [opts.isTopLevel]	{Boolean}
+		 *	@param [opts.isInclusionOk]	{Boolean}
+		 **/
 		var klass = function ObjectCtx(opts /*= {isDocumentOk:..., isTopLevel:..., isInclusionOk:...}*/){
 		var klass = function ObjectCtx(opts /*= {isDocumentOk:..., isTopLevel:..., isInclusionOk:...}*/){
 			if(!(opts instanceof Object && opts.constructor == Object)) throw new Error("opts is required and must be an Object containing named args");
 			if(!(opts instanceof Object && opts.constructor == Object)) throw new Error("opts is required and must be an Object containing named args");
 			for (var k in opts) { // assign all given opts to self so long as they were part of klass.prototype as undefined properties
 			for (var k in opts) { // assign all given opts to self so long as they were part of klass.prototype as undefined properties
@@ -58,24 +59,24 @@ var Expression = module.exports = (function(){
 	})();
 	})();
 
 
 	/**
 	/**
-	* Reference to the `munge.pipeline.expressions.Expression.OpDesc` class
-	* @static
-	* @property OpDesc
-	**/
+	 * Reference to the `munge.pipeline.expressions.Expression.OpDesc` class
+	 * @static
+	 * @property OpDesc
+	 **/
 	var OpDesc = Expression.OpDesc = (function(){
 	var OpDesc = Expression.OpDesc = (function(){
 		// CONSTRUCTOR
 		// CONSTRUCTOR
 		/**
 		/**
-		* Decribes how and when to create an Op instance
-		*
-		* @class OpDesc
-		* @namespace munge.pipeline.expressions.Expression
-		* @module munge
-		* @constructor
-		* @param name
-		* @param factory
-		* @param flags
-		* @param argCount
-		**/
+		 * Decribes how and when to create an Op instance
+		 *
+		 * @class OpDesc
+		 * @namespace mungedb.aggregate.pipeline.expressions.Expression
+		 * @module mungedb-aggregate
+		 * @constructor
+		 * @param name
+		 * @param factory
+		 * @param flags
+		 * @param argCount
+		 **/
 		var klass = function OpDesc(name, factory, flags, argCount){
 		var klass = function OpDesc(name, factory, flags, argCount){
 			var firstArg = arguments[0];
 			var firstArg = arguments[0];
 			if (firstArg instanceof Object && firstArg.constructor == Object) { //TODO: using this?
 			if (firstArg instanceof Object && firstArg.constructor == Object) { //TODO: using this?
@@ -102,10 +103,10 @@ var Expression = module.exports = (function(){
 		proto.argCount = undefined;
 		proto.argCount = undefined;
 
 
 		/**
 		/**
-		* internal `OpDesc#name` comparer
-		* @method cmp
-		* @param that the other `OpDesc` instance
-		**/
+		 * internal `OpDesc#name` comparer
+		 * @method cmp
+		 * @param that the other `OpDesc` instance
+		 **/
 		proto.cmp = function cmp(that) {
 		proto.cmp = function cmp(that) {
 			return this.name < that.name ? -1 : this.name > that.name ? 1 : 0;
 			return this.name < that.name ? -1 : this.name > that.name ? 1 : 0;
 		};
 		};
@@ -114,10 +115,10 @@ var Expression = module.exports = (function(){
 	})();
 	})();
 	// END OF NESTED CLASSES
 	// END OF NESTED CLASSES
 	/**
 	/**
-	* @class Expression
-	* @namespace munge.pipeline.expressions
-	* @module munge
-	**/
+	 * @class Expression
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
+	 **/
 
 
 	var kinds = {
 	var kinds = {
 		UNKNOWN: "UNKNOWN",
 		UNKNOWN: "UNKNOWN",
@@ -128,11 +129,11 @@ var Expression = module.exports = (function(){
 
 
 	// STATIC MEMBERS
 	// STATIC MEMBERS
 	/**
 	/**
-	* Enumeration of comparison operators.  These are shared between a few expression implementations, so they are factored out here.
-	*
-	* @static
-	* @property CmpOp
-	**/
+	 * Enumeration of comparison operators.  These are shared between a few expression implementations, so they are factored out here.
+	 *
+	 * @static
+	 * @property CmpOp
+	 **/
 	klass.CmpOp = {
 	klass.CmpOp = {
 		EQ: "$eq",		// return true for a == b, false otherwise
 		EQ: "$eq",		// return true for a == b, false otherwise
 		NE: "$ne",		// return true for a != b, false otherwise
 		NE: "$ne",		// return true for a != b, false otherwise
@@ -151,11 +152,11 @@ var Expression = module.exports = (function(){
 
 
 	// DEFERRED DEPENDENCIES
 	// DEFERRED DEPENDENCIES
 	/**
 	/**
-	* Expressions, as exposed to users
-	*
-	* @static
-	* @property opMap
-	**/
+	 * Expressions, as exposed to users
+	 *
+	 * @static
+	 * @property opMap
+	 **/
 	process.nextTick(function(){ // Even though `opMap` is deferred, force it to load early rather than later to prevent even *more* potential silliness
 	process.nextTick(function(){ // Even though `opMap` is deferred, force it to load early rather than later to prevent even *more* potential silliness
 		Object.defineProperty(klass, "opMap", {value:klass.opMap});
 		Object.defineProperty(klass, "opMap", {value:klass.opMap});
 	});
 	});
@@ -202,19 +203,19 @@ var Expression = module.exports = (function(){
 	});
 	});
 
 
 	/**
 	/**
-	* Parse an Object.  The object could represent a functional expression or a Document expression.
-	*
-	* An object expression can take any of the following forms:
-	*
-	*	f0: {f1: ..., f2: ..., f3: ...}
-	*	f0: {$operator:[operand1, operand2, ...]}
-	*
-	* @static
-	* @method parseObject
-	* @param obj	the element representing the object
-	* @param ctx	a MiniCtx representing the options above
-	* @returns the parsed Expression
-	**/
+	 * Parse an Object.  The object could represent a functional expression or a Document expression.
+	 *
+	 * An object expression can take any of the following forms:
+	 *
+	 *	f0: {f1: ..., f2: ..., f3: ...}
+	 *	f0: {$operator:[operand1, operand2, ...]}
+	 *
+	 * @static
+	 * @method parseObject
+	 * @param obj	the element representing the object
+	 * @param ctx	a MiniCtx representing the options above
+	 * @returns the parsed Expression
+	 **/
 	klass.parseObject = function parseObject(obj, ctx){
 	klass.parseObject = function parseObject(obj, ctx){
 		if(!(ctx instanceof ObjectCtx)) throw new Error("ctx must be ObjectCtx");
 		if(!(ctx instanceof ObjectCtx)) throw new Error("ctx must be ObjectCtx");
 		var kind = kinds.UNKNOWN,
 		var kind = kinds.UNKNOWN,
@@ -272,14 +273,14 @@ var Expression = module.exports = (function(){
 	};
 	};
 
 
 	/**
 	/**
-	* Parse a BSONElement Object which has already been determined to be functional expression.
-	*
-	* @static
-	* @method parseExpression
-	* @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.
+	 *
+	 * @static
+	 * @method parseExpression
+	 * @param opName	the name of the (prefix) operator
+	 * @param obj	the BSONElement to parse
+	 * @returns the parsed Expression
+	 **/
 	klass.parseExpression = function parseExpression(opName, obj) {
 	klass.parseExpression = function parseExpression(opName, obj) {
 		// look for the specified operator
 		// look for the specified operator
 		if (opName === "$const") return new ConstantExpression(obj); //TODO: createFromBsonElement was here, not needed since this isn't BSON?
 		if (opName === "$const") return new ConstantExpression(obj); //TODO: createFromBsonElement was here, not needed since this isn't BSON?
@@ -313,12 +314,12 @@ var Expression = module.exports = (function(){
 	};
 	};
 
 
 	/**
 	/**
-	* Parse a BSONElement which is an operand in an Expression.
-	*
-	* @static
-	* @param pBsonElement the expected operand's BSONElement
-	* @returns the parsed operand, as an Expression
-	**/
+	 * Parse a BSONElement which is an operand in an Expression.
+	 *
+	 * @static
+	 * @param pBsonElement the expected operand's BSONElement
+	 * @returns the parsed operand, as an Expression
+	 **/
 	klass.parseOperand = function parseOperand(obj){
 	klass.parseOperand = function parseOperand(obj){
 		var t = typeof(obj);
 		var t = typeof(obj);
 		if (t === "string" && obj[0] == "$") { //if we got here, this is a field path expression
 		if (t === "string" && obj[0] == "$") { //if we got here, this is a field path expression
@@ -330,13 +331,13 @@ var Expression = module.exports = (function(){
 	};
 	};
 
 
 	/**
 	/**
-	* Produce a field path string with the field prefix removed.
-	* Throws an error if the field prefix is not present.
-	*
-	* @static
-	* @param prefixedField the prefixed field
-	* @returns the field path with the prefix removed
-	**/
+	 * Produce a field path string with the field prefix removed.
+	 * Throws an error if the field prefix is not present.
+	 *
+	 * @static
+	 * @param prefixedField the prefixed field
+	 * @returns the field path with the prefix removed
+	 **/
 	klass.removeFieldPrefix = function removeFieldPrefix(prefixedField) {
 	klass.removeFieldPrefix = function removeFieldPrefix(prefixedField) {
 		if (prefixedField.indexOf("\0") != -1) throw new Error("field path must not contain embedded null characters; code 16419");
 		if (prefixedField.indexOf("\0") != -1) throw new Error("field path must not contain embedded null characters; code 16419");
 		if (prefixedField[0] !== "$") throw new Error("field path references must be prefixed with a '$' ('" + prefixedField + "'); code 15982");
 		if (prefixedField[0] !== "$") throw new Error("field path references must be prefixed with a '$' ('" + prefixedField + "'); code 15982");
@@ -344,12 +345,12 @@ var Expression = module.exports = (function(){
 	};
 	};
 
 
 	/**
 	/**
-	* returns the signe of a number
-	*
-	* @static
-	* @method signum
-	* @returns the sign of a number; -1, 1, or 0
-	**/
+	 * returns the signe of a number
+	 *
+	 * @static
+	 * @method signum
+	 * @returns the sign of a number; -1, 1, or 0
+	 **/
 	klass.signum = function signum(i) {
 	klass.signum = function signum(i) {
 		if (i < 0) return -1;
 		if (i < 0) return -1;
 		if (i > 0) return 1;
 		if (i > 0) return 1;
@@ -359,50 +360,50 @@ var Expression = module.exports = (function(){
 
 
 	// PROTOTYPE MEMBERS
 	// PROTOTYPE MEMBERS
 	/**
 	/**
-	* Evaluate the Expression using the given document as input.
-	*
-	* @method evaluate
-	* @returns the computed value
-	**/
+	 * Evaluate the Expression using the given document as input.
+	 *
+	 * @method evaluate
+	 * @returns the computed value
+	 **/
 	proto.evaluate = function evaluate(obj) {
 	proto.evaluate = function evaluate(obj) {
 		throw new Error("WAS NOT IMPLEMENTED BY INHERITOR!");
 		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.
-	*
-	* @method optimize
-	* @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.
+	 *
+	 * @method optimize
+	 * @returns the optimized Expression
+	 **/
 	proto.optimize = function optimize() {
 	proto.optimize = function optimize() {
 		throw new Error("WAS NOT IMPLEMENTED BY INHERITOR!");
 		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.
-	*
-	* 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.
-	*
-	* @method addDependencies
-	* @param deps	output parameter
-	* @param path	path to self if all ancestors are ExpressionObjects.
-	**/
+	 * 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.
+	 *
+	 * @method addDependencies
+	 * @param deps	output parameter
+	 * @param path	path to self if all ancestors are ExpressionObjects.
+	 **/
 	proto.addDependencies = function addDependencies(deps, path) {
 	proto.addDependencies = function addDependencies(deps, path) {
 		throw new Error("WAS NOT IMPLEMENTED BY INHERITOR!");
 		throw new Error("WAS NOT IMPLEMENTED BY INHERITOR!");
 	};
 	};
 
 
 	/**
 	/**
-	* simple expressions are just inclusion exclusion as supported by ExpressionObject
-	* @method getIsSimple
-	**/
+	 * simple expressions are just inclusion exclusion as supported by ExpressionObject
+	 * @method getIsSimple
+	 **/
 	proto.getIsSimple = function getIsSimple() {
 	proto.getIsSimple = function getIsSimple() {
 		return false;
 		return false;
 	};
 	};

+ 23 - 22
lib/pipeline/expressions/FieldPathExpression.js

@@ -1,15 +1,16 @@
+"use strict";
 var FieldPathExpression = module.exports = (function(){
 var FieldPathExpression = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/**
 	/**
-	* Create a field path expression. Evaluation will extract the value associated with the given field path from the source document.
-	*
-	* @class FieldPathExpression
-	* @namespace munge.pipeline.expressions
-	* @module munge
-	* @extends munge.pipeline.expressions.Expression
-	* @constructor
-	* @param {String} fieldPath the field path string, without any leading document indicator
-	**/
+	 * Create a field path expression. Evaluation will extract the value associated with the given field path from the source document.
+	 *
+	 * @class FieldPathExpression
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
+	 * @extends munge.pipeline.expressions.Expression
+	 * @constructor
+	 * @param {String} fieldPath the field path string, without any leading document indicator
+	 **/
 	var klass = function FieldPathExpression(path){
 	var klass = function FieldPathExpression(path){
 		if(arguments.length !== 1) throw new Error("args expected: path");
 		if(arguments.length !== 1) throw new Error("args expected: path");
 		this.path = new FieldPath(path);
 		this.path = new FieldPath(path);
@@ -24,19 +25,19 @@ var FieldPathExpression = module.exports = (function(){
 	};
 	};
 
 
 	/**
 	/**
-	* Internal implementation of evaluate(), used recursively.
-	*
-	* The internal implementation doesn't just use a loop because of the
-	* possibility that we need to skip over an array.  If the path is "a.b.c",
-	* and a is an array, then we fan out from there, and traverse "b.c" for each
-	* element of a:[...].  This requires that a be an array of objects in order
-	* to navigate more deeply.
-	*
-	* @param index current path field index to extract
-	* @param pathLength maximum number of fields on field path
-	* @param pDocument current document traversed to (not the top-level one)
-	* @returns the field found; could be an array
-	**/
+	 * Internal implementation of evaluate(), used recursively.
+	 *
+	 * The internal implementation doesn't just use a loop because of the
+	 * possibility that we need to skip over an array.  If the path is "a.b.c",
+	 * and a is an array, then we fan out from there, and traverse "b.c" for each
+	 * element of a:[...].  This requires that a be an array of objects in order
+	 * to navigate more deeply.
+	 *
+	 * @param index current path field index to extract
+	 * @param pathLength maximum number of fields on field path
+	 * @param pDocument current document traversed to (not the top-level one)
+	 * @returns the field found; could be an array
+	 **/
 	proto._evaluatePath = function _evaluatePath(obj, i, len){
 	proto._evaluatePath = function _evaluatePath(obj, i, len){
 		var fieldName = this.path.fields[i],
 		var fieldName = this.path.fields[i],
 			field = obj[fieldName]; // It is possible we won't have an obj (document) and we need to not fail if that is the case
 			field = obj[fieldName]; // It is possible we won't have an obj (document) and we need to not fail if that is the case

+ 40 - 38
lib/pipeline/expressions/FieldRangeExpression.js

@@ -1,29 +1,30 @@
+"use strict";
 var FieldRangeExpression = module.exports = (function(){
 var FieldRangeExpression = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/**
 	/**
-	* Create a field range expression.
-	*
-	* Field ranges are meant to match up with classic Matcher semantics, and therefore are conjunctions.
-	*
-	* For example, these appear in mongo shell predicates in one of these forms:
-	*	{ a : C } -> (a == C) // degenerate "point" range
-	*	{ a : { $lt : C } } -> (a < C) // open range
-	*	{ a : { $gt : C1, $lte : C2 } } -> ((a > C1) && (a <= C2)) // closed
-	*
-	* When initially created, a field range only includes one end of the range.  Additional points may be added via intersect().
-	*
-	* Note that NE and CMP are not supported.
-	*
-	* @class FieldRangeExpression
-	* @namespace munge.pipeline.expressions
-	* @module munge
-	* @extends munge.pipeline.expressions.Expression
-	* @constructor
-	* @param pathExpr the field path for extracting the field value
-	* @param cmpOp the comparison operator
-	* @param value the value to compare against
-	* @returns the newly created field range expression
-	**/
+	 * Create a field range expression.
+	 *
+	 * Field ranges are meant to match up with classic Matcher semantics, and therefore are conjunctions.
+	 *
+	 * For example, these appear in mongo shell predicates in one of these forms:
+	 *	{ a : C } -> (a == C) // degenerate "point" range
+	 *	{ a : { $lt : C } } -> (a < C) // open range
+	 *	{ a : { $gt : C1, $lte : C2 } } -> ((a > C1) && (a <= C2)) // closed
+	 *
+	 * When initially created, a field range only includes one end of the range.  Additional points may be added via intersect().
+	 *
+	 * Note that NE and CMP are not supported.
+	 *
+	 * @class FieldRangeExpression
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
+	 * @extends munge.pipeline.expressions.Expression
+	 * @constructor
+	 * @param pathExpr the field path for extracting the field value
+	 * @param cmpOp the comparison operator
+	 * @param value the value to compare against
+	 * @returns the newly created field range expression
+	 **/
 	var klass = function FieldRangeExpression(pathExpr, cmpOp, value){
 	var klass = function FieldRangeExpression(pathExpr, cmpOp, value){
 		if(arguments.length !== 3) throw new Error("args expected: pathExpr, cmpOp, and value");
 		if(arguments.length !== 3) throw new Error("args expected: pathExpr, cmpOp, and value");
 		this.pathExpr = pathExpr;
 		this.pathExpr = pathExpr;
@@ -37,9 +38,9 @@ var FieldRangeExpression = module.exports = (function(){
 	// NESTED CLASSES
 	// NESTED CLASSES
 	var Range = (function(){
 	var Range = (function(){
 		/**
 		/**
-		* create a new Range; opts is either {cmpOp:..., value:...} or {bottom:..., isBottomOpen:..., top:..., isTopOpen:...}
-		* @private
-		**/
+		 * create a new Range; opts is either {cmpOp:..., value:...} or {bottom:..., isBottomOpen:..., top:..., isTopOpen:...}
+		 * @private
+		 **/
 		var klass = function Range(opts){
 		var klass = function Range(opts){
 			this.isBottomOpen = this.isTopOpen = false;
 			this.isBottomOpen = this.isTopOpen = false;
 			this.bottom = this.top = undefined;
 			this.bottom = this.top = undefined;
@@ -155,18 +156,19 @@ var FieldRangeExpression = module.exports = (function(){
 	};
 	};
 
 
 	/**
 	/**
-	* Add an intersecting range.
-	*
-	* This can be done any number of times after creation.  The range is
-	* internally optimized for each new addition.  If the new intersection
-	* extends or reduces the values within the range, the internal
-	* representation is adjusted to reflect that.
-	*
-	* Note that NE and CMP are not supported.
-	*
-	* @param cmpOp the comparison operator
-	* @param pValue the value to compare against
-	**/
+	 * Add an intersecting range.
+	 *
+	 * This can be done any number of times after creation.  The range is
+	 * internally optimized for each new addition.  If the new intersection
+	 * extends or reduces the values within the range, the internal
+	 * representation is adjusted to reflect that.
+	 *
+	 * Note that NE and CMP are not supported.
+	 *
+	 * @method intersect
+	 * @param cmpOp the comparison operator
+	 * @param pValue the value to compare against
+	 **/
 	proto.intersect = function intersect(cmpOp, value){
 	proto.intersect = function intersect(cmpOp, value){
 		this.range = this.range.intersect(new Range({cmpOp:cmpOp, value:value}));
 		this.range = this.range.intersect(new Range({cmpOp:cmpOp, value:value}));
 	};
 	};

+ 7 - 5
lib/pipeline/expressions/HourExpression.js

@@ -1,3 +1,4 @@
+"use strict";
 var HourExpression = module.exports = (function(){
 var HourExpression = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/** 
 	/** 
@@ -5,10 +6,10 @@ var HourExpression = module.exports = (function(){
 	 *
 	 *
 	 * @see evaluate 
 	 * @see evaluate 
 	 * @class HourExpression
 	 * @class HourExpression
-	 * @namespace munge.pipeline.expressions
-	 * @module munge
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
 	 * @constructor
 	 * @constructor
-	**/
+	 **/
 	var klass = function HourExpression(){
 	var klass = function HourExpression(){
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		base.call(this);
 		base.call(this);
@@ -25,8 +26,9 @@ var HourExpression = module.exports = (function(){
 	};
 	};
 
 
 	/** 
 	/** 
-	* Takes a date and returns the hour between 0 and 23. 
-	**/
+	 * Takes a date and returns the hour between 0 and 23. 
+	 * @method evaluate
+	 **/
 	proto.evaluate = function evaluate(doc){
 	proto.evaluate = function evaluate(doc){
 		this.checkArgCount(1);
 		this.checkArgCount(1);
 		var date = this.operands[0].evaluate(doc);
 		var date = this.operands[0].evaluate(doc);

+ 7 - 5
lib/pipeline/expressions/IfNullExpression.js

@@ -1,3 +1,4 @@
+"use strict";
 var IfNullExpression = module.exports = (function(){
 var IfNullExpression = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/**
 	/**
@@ -5,10 +6,10 @@ var IfNullExpression = module.exports = (function(){
 	 *
 	 *
 	 * @see evaluate
 	 * @see evaluate
 	 * @class IfNullExpression
 	 * @class IfNullExpression
-	 * @namespace munge.pipeline.expressions
-	 * @module munge
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
 	 * @constructor
 	 * @constructor
-	**/
+	 **/
 	var klass = function IfNullExpression(){
 	var klass = function IfNullExpression(){
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		base.call(this);
 		base.call(this);
@@ -25,8 +26,9 @@ var IfNullExpression = module.exports = (function(){
 	};
 	};
 
 
 	/**
 	/**
-	* Use the $ifNull operator with the following syntax: { $ifNull: [ <expression>, <replacement-if-null> ] }
-	**/
+	 * Use the $ifNull operator with the following syntax: { $ifNull: [ <expression>, <replacement-if-null> ] }
+	 * @method evaluate
+	 **/
 	proto.evaluate = function evaluate(doc){
 	proto.evaluate = function evaluate(doc){
 		this.checkArgCount(2);
 		this.checkArgCount(2);
 		var left = this.operands[0].evaluate(doc);
 		var left = this.operands[0].evaluate(doc);

+ 7 - 6
lib/pipeline/expressions/IndexOfExpression.js

@@ -1,3 +1,4 @@
+"use strict";
 var IndexOfExpression = module.exports = (function(){
 var IndexOfExpression = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/**
 	/**
@@ -5,10 +6,10 @@ var IndexOfExpression = module.exports = (function(){
 	 *
 	 *
 	 * @see evaluate
 	 * @see evaluate
 	 * @class IndexOfExpression
 	 * @class IndexOfExpression
-	 * @namespace munge.pipeline.expressions
-	 * @module munge
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
 	 * @constructor
 	 * @constructor
-	**/
+	 **/
 	var klass = function IndexOfExpression(){
 	var klass = function IndexOfExpression(){
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		base.call(this);
 		base.call(this);
@@ -25,9 +26,9 @@ var IndexOfExpression = module.exports = (function(){
 	};
 	};
 
 
 	/**
 	/**
-	* Use the $indexOf operator with the following syntax: { $indexOf: [ <needle>, <haystack> ] }
-	* @method evaluate
-	**/
+	 * Use the $indexOf operator with the following syntax: { $indexOf: [ <needle>, <haystack> ] }
+	 * @method evaluate
+	 **/
 	proto.evaluate = function evaluate(doc){
 	proto.evaluate = function evaluate(doc){
 		this.checkArgCount(2);
 		this.checkArgCount(2);
 
 

+ 7 - 5
lib/pipeline/expressions/MinuteExpression.js

@@ -1,3 +1,4 @@
+"use strict";
 var MinuteExpression = module.exports = (function(){
 var MinuteExpression = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/** 
 	/** 
@@ -5,10 +6,10 @@ var MinuteExpression = module.exports = (function(){
 	 *
 	 *
 	 * @see evaluate 
 	 * @see evaluate 
 	 * @class MinuteExpression
 	 * @class MinuteExpression
-	 * @namespace munge.pipeline.expressions
-	 * @module munge
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
 	 * @constructor
 	 * @constructor
-	**/
+	 **/
 	var klass = function MinuteExpression(){
 	var klass = function MinuteExpression(){
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		base.call(this);
 		base.call(this);
@@ -25,8 +26,9 @@ var MinuteExpression = module.exports = (function(){
 	};
 	};
 
 
 	/** 
 	/** 
-	* Takes a date and returns the minute between 0 and 59. 
-	**/
+	 * Takes a date and returns the minute between 0 and 59. 
+	 * @method evaluate
+	 **/
 	proto.evaluate = function evaluate(doc){
 	proto.evaluate = function evaluate(doc){
 		this.checkArgCount(1);
 		this.checkArgCount(1);
 		var date = this.operands[0].evaluate(doc);
 		var date = this.operands[0].evaluate(doc);

+ 7 - 5
lib/pipeline/expressions/ModExpression.js

@@ -1,3 +1,4 @@
+"use strict";
 var ModExpression = module.exports = (function(){
 var ModExpression = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/** 
 	/** 
@@ -5,10 +6,10 @@ var ModExpression = module.exports = (function(){
 	 *
 	 *
 	 * @see evaluate 
 	 * @see evaluate 
 	 * @class ModExpression
 	 * @class ModExpression
-	 * @namespace munge.pipeline.expressions
-	 * @module munge
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
 	 * @constructor
 	 * @constructor
-	**/
+	 **/
 	var klass = function ModExpression(){
 	var klass = function ModExpression(){
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		base.call(this);
 		base.call(this);
@@ -28,8 +29,9 @@ var ModExpression = module.exports = (function(){
 	};
 	};
 
 
 	/** 
 	/** 
-	* Takes an array that contains a pair of numbers and returns the remainder of the first number divided by the second number. 
-	**/
+	 * Takes an array that contains a pair of numbers and returns the remainder of the first number divided by the second number. 
+	 * @method evaluate
+	 **/
 	proto.evaluate = function evaluate(doc){
 	proto.evaluate = function evaluate(doc){
 		this.checkArgCount(2);
 		this.checkArgCount(2);
 		var left = this.operands[0].evaluate(doc),
 		var left = this.operands[0].evaluate(doc),

+ 7 - 6
lib/pipeline/expressions/MonthExpression.js

@@ -1,3 +1,4 @@
+"use strict";
 var MonthExpression = module.exports = (function(){
 var MonthExpression = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/** 
 	/** 
@@ -5,10 +6,10 @@ var MonthExpression = module.exports = (function(){
 	 *
 	 *
 	 * @see evaluate 
 	 * @see evaluate 
 	 * @class MonthExpression
 	 * @class MonthExpression
-	 * @namespace munge.pipeline.expressions
-	 * @module munge
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
 	 * @constructor
 	 * @constructor
-	**/
+	 **/
 	var klass = function MonthExpression(){
 	var klass = function MonthExpression(){
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		base.call(this);
 		base.call(this);
@@ -25,9 +26,9 @@ var MonthExpression = module.exports = (function(){
 	};
 	};
 
 
 	/**
 	/**
-	* Takes a date and returns the month as a number between 1 and 12.
-	* @method evaluate
-	**/
+	 * Takes a date and returns the month as a number between 1 and 12.
+	 * @method evaluate
+	 **/
 	proto.evaluate = function evaluate(doc){
 	proto.evaluate = function evaluate(doc){
 		this.checkArgCount(1);
 		this.checkArgCount(1);
 		var date = this.operands[0].evaluate(doc);
 		var date = this.operands[0].evaluate(doc);

+ 7 - 5
lib/pipeline/expressions/MultiplyExpression.js

@@ -1,3 +1,4 @@
+"use strict";
 var MultiplyExpression = module.exports = (function(){
 var MultiplyExpression = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/** 
 	/** 
@@ -5,10 +6,10 @@ var MultiplyExpression = module.exports = (function(){
 	 *
 	 *
 	 * @see evaluate 
 	 * @see evaluate 
 	 * @class MultiplyExpression
 	 * @class MultiplyExpression
-	 * @namespace munge.pipeline.expressions
-	 * @module munge
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
 	 * @constructor
 	 * @constructor
-	**/
+	 **/
 	var klass = function MultiplyExpression(){
 	var klass = function MultiplyExpression(){
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		base.call(this);
 		base.call(this);
@@ -23,8 +24,9 @@ var MultiplyExpression = module.exports = (function(){
 	};
 	};
 
 
 	/** 
 	/** 
-	* Takes an array of one or more numbers and multiples them, returning the resulting product. 
-	**/
+	 * Takes an array of one or more numbers and multiples them, returning the resulting product. 
+	 * @method evaluate
+	 **/
 	proto.evaluate = function evaluate(doc){
 	proto.evaluate = function evaluate(doc){
 		var product = 1;
 		var product = 1;
 		for(var i = 0, n = this.operands.length; i < n; ++i){
 		for(var i = 0, n = this.operands.length; i < n; ++i){

+ 25 - 25
lib/pipeline/expressions/NaryExpression.js

@@ -1,14 +1,14 @@
 var NaryExpression = module.exports = (function(){
 var NaryExpression = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/**
 	/**
-	* The base class for all n-ary `Expression`s
-	*
-	* @class NaryExpression
-	* @namespace munge.pipeline.expressions
-	* @module munge
-	* @extends munge.pipeline.expressions.Expression
-	* @constructor
-	**/
+	 * The base class for all n-ary `Expression`s
+	 *
+	 * @class NaryExpression
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
+	 * @extends munge.pipeline.expressions.Expression
+	 * @constructor
+	 **/
 	var klass = module.exports = function NaryExpression(){
 	var klass = module.exports = function NaryExpression(){
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		this.operands = [];
 		this.operands = [];
@@ -92,11 +92,11 @@ var NaryExpression = module.exports = (function(){
 	};
 	};
 
 
 	/**
 	/**
-	* Add an operand to the n-ary expression.
-	*
-	* @method addOperand
-	* @param pExpression the expression to add
-	**/
+	 * Add an operand to the n-ary expression.
+	 *
+	 * @method addOperand
+	 * @param pExpression the expression to add
+	 **/
 	proto.addOperand = function addOperand(expr) {
 	proto.addOperand = function addOperand(expr) {
 		this.operands.push(expr);
 		this.operands.push(expr);
 	};
 	};
@@ -117,23 +117,23 @@ var NaryExpression = module.exports = (function(){
 //TODO: proto.addToBsonArray  ?
 //TODO: proto.addToBsonArray  ?
 
 
 	/**
 	/**
-	* Checks the current size of vpOperand; if the size equal to or greater than maxArgs, fires a user assertion indicating that this operator cannot have this many arguments.
-	* The equal is there because this is intended to be used in addOperand() to check for the limit *before* adding the requested argument.
-	*
-	* @method checkArgLimit
-	* @param maxArgs the maximum number of arguments the operator accepts
-	**/
+	 * Checks the current size of vpOperand; if the size equal to or greater than maxArgs, fires a user assertion indicating that this operator cannot have this many arguments.
+	 * The equal is there because this is intended to be used in addOperand() to check for the limit *before* adding the requested argument.
+	 *
+	 * @method checkArgLimit
+	 * @param maxArgs the maximum number of arguments the operator accepts
+	 **/
 	proto.checkArgLimit = function checkArgLimit(maxArgs) {
 	proto.checkArgLimit = function checkArgLimit(maxArgs) {
 		if (this.operands.length >= maxArgs) throw new Error(this.getOpName() + " only takes " + maxArgs + " operand" + (maxArgs == 1 ? "" : "s") + "; code 15993");
 		if (this.operands.length >= maxArgs) throw new Error(this.getOpName() + " only takes " + maxArgs + " operand" + (maxArgs == 1 ? "" : "s") + "; code 15993");
 	};
 	};
 
 
 	/**
 	/**
-	* Checks the current size of vpOperand; if the size is not equal to reqArgs, fires a user assertion indicating that this must have exactly reqArgs arguments.
-	* This is meant to be used in evaluate(), *before* the evaluation takes place.
-	*
-	* @method checkArgCount
-	* @param reqArgs the number of arguments this operator requires
-	**/
+	 * Checks the current size of vpOperand; if the size is not equal to reqArgs, fires a user assertion indicating that this must have exactly reqArgs arguments.
+	 * This is meant to be used in evaluate(), *before* the evaluation takes place.
+	 *
+	 * @method checkArgCount
+	 * @param reqArgs the number of arguments this operator requires
+	 **/
 	proto.checkArgCount = function checkArgCount(reqArgs) {
 	proto.checkArgCount = function checkArgCount(reqArgs) {
 		if (this.operands.length !== reqArgs) throw new Error(this.getOpName() + ":  insufficient operands; " + reqArgs + " required, only got " + this.operands.length + "; code 15997");
 		if (this.operands.length !== reqArgs) throw new Error(this.getOpName() + ":  insufficient operands; " + reqArgs + " required, only got " + this.operands.length + "; code 15997");
 	};
 	};

+ 9 - 8
lib/pipeline/expressions/NotExpression.js

@@ -1,14 +1,14 @@
 var NotExpression = module.exports = (function(){
 var NotExpression = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/** 
 	/** 
-	* An $not pipeline expression. 
-	*
-	* @see evaluate 
+	 * An $not pipeline expression. 
+	 *
+	 * @see evaluate 
 	 * @class NotExpression
 	 * @class NotExpression
-	 * @namespace munge.pipeline.expressions
-	 * @module munge
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
 	 * @constructor
 	 * @constructor
-	**/
+	 **/
 	var klass = function NotExpression(){
 	var klass = function NotExpression(){
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		base.call(this);
 		base.call(this);
@@ -28,8 +28,9 @@ var NotExpression = module.exports = (function(){
 	};
 	};
 
 
 	/** 
 	/** 
-	* Returns the boolean opposite value passed to it. When passed a true value, $not returns false; when passed a false value, $not returns true. 
-	**/
+	 * Returns the boolean opposite value passed to it. When passed a true value, $not returns false; when passed a false value, $not returns true. 
+	 * @method evaluate
+	 **/
 	proto.evaluate = function evaluate(doc){
 	proto.evaluate = function evaluate(doc){
 		this.checkArgCount(1);
 		this.checkArgCount(1);
 		var op = this.operands[0].evaluate(doc);
 		var op = this.operands[0].evaluate(doc);

+ 51 - 51
lib/pipeline/expressions/ObjectExpression.js

@@ -1,14 +1,14 @@
 var ObjectExpression = module.exports = (function(){
 var ObjectExpression = module.exports = (function(){
 	// CONSTRUCTOR
 	// CONSTRUCTOR
 	/**
 	/**
-	* Create an empty expression.  Until fields are added, this will evaluate to an empty document (object).
-	*
-	* @class ObjectExpression
-	* @namespace munge.pipeline.expressions
-	* @module munge
-	* @extends munge.pipeline.expressions.Expression
-	* @constructor
-	**/
+	 * Create an empty expression.  Until fields are added, this will evaluate to an empty document (object).
+	 *
+	 * @class ObjectExpression
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
+	 * @extends munge.pipeline.expressions.Expression
+	 * @constructor
+	 **/
 	var klass = function ObjectExpression(){
 	var klass = function ObjectExpression(){
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		this.excludeId = false;	/// <Boolean> for if _id is to be excluded
 		this.excludeId = false;	/// <Boolean> for if _id is to be excluded
@@ -22,33 +22,33 @@ var ObjectExpression = module.exports = (function(){
 
 
 	// INSTANCE VARIABLES
 	// INSTANCE VARIABLES
 	/**
 	/**
-	* <Boolean> for if _id is to be excluded
-	*
-	* @property excludeId
-	**/
+	 * <Boolean> for if _id is to be excluded
+	 *
+	 * @property excludeId
+	 **/
 	proto.excludeId = undefined;
 	proto.excludeId = undefined;
 
 
 	/**
 	/**
-	* <Object<Expression>> mapping from fieldname to Expression to generate the value NULL expression means include from source document
-	**/
+	 * <Object<Expression>> mapping from fieldname to Expression to generate the value NULL expression means include from source document
+	 **/
 	proto._expressions = undefined;
 	proto._expressions = undefined;
 
 
 	//TODO: might be able to completely ditch _order everywhere in here since `Object`s are mostly ordered anyhow but need to come back and revisit that later
 	//TODO: might be able to completely ditch _order everywhere in here since `Object`s are mostly ordered anyhow but need to come back and revisit that later
 	/**
 	/**
-	* <Array<String>> this is used to maintain order for generated fields not in the source document
-	**/
+	 * <Array<String>> this is used to maintain order for generated fields not in the source document
+	 **/
 	proto._order = [];
 	proto._order = [];
 
 
 
 
 	// PROTOTYPE MEMBERS
 	// PROTOTYPE MEMBERS
 
 
 	/**
 	/**
-	* evaluate(), but return a Document instead of a Value-wrapped Document.
-	*
-	* @method evaluateDocument
-	* @param pDocument the input Document
-	* @returns the result document
-	**/
+	 * evaluate(), but return a Document instead of a Value-wrapped Document.
+	 *
+	 * @method evaluateDocument
+	 * @param pDocument the input Document
+	 * @returns the result document
+	 **/
 	proto.evaluateDocument = function evaluateDocument(doc) {
 	proto.evaluateDocument = function evaluateDocument(doc) {
 		// create and populate the result
 		// create and populate the result
 		var pResult = {};
 		var pResult = {};
@@ -105,13 +105,13 @@ var ObjectExpression = module.exports = (function(){
 	};
 	};
 
 
 	/**
 	/**
-	* evaluate(), but add the evaluated fields to a given document instead of creating a new one.
-	*
-	* @method addToDocument
-	* @param pResult the Document to add the evaluated expressions to
-	* @param pDocument the input Document for this level
-	* @param rootDoc the root of the whole input document
-	**/
+	 * evaluate(), but add the evaluated fields to a given document instead of creating a new one.
+	 *
+	 * @method addToDocument
+	 * @param pResult the Document to add the evaluated expressions to
+	 * @param pDocument the input Document for this level
+	 * @param rootDoc the root of the whole input document
+	 **/
 	proto.addToDocument = function addToDocument(pResult, pDocument, rootDoc){
 	proto.addToDocument = function addToDocument(pResult, pDocument, rootDoc){
 		var atRoot = (pDocument === rootDoc);
 		var atRoot = (pDocument === rootDoc);
 
 
@@ -199,22 +199,22 @@ var ObjectExpression = module.exports = (function(){
 	};
 	};
 
 
 	/**
 	/**
-	* estimated number of fields that will be output
-	*
-	* @method getSizeHint
-	**/
+	 * estimated number of fields that will be output
+	 *
+	 * @method getSizeHint
+	 **/
 	proto.getSizeHint = function getSizeHint(){
 	proto.getSizeHint = function getSizeHint(){
 		// Note: this can overestimate, but that is better than underestimating
 		// Note: this can overestimate, but that is better than underestimating
 		return Object.getOwnPropertyNames(this._expressions).length + (this.excludeId ? 0 : 1);
 		return Object.getOwnPropertyNames(this._expressions).length + (this.excludeId ? 0 : 1);
 	};
 	};
 
 
 	/**
 	/**
-	* Add a field to the document expression.
-	*
-	* @method addField
-	* @param fieldPath the path the evaluated expression will have in the result Document
-	* @param pExpression the expression to evaluate obtain this field's Value in the result Document
-	**/
+	 * Add a field to the document expression.
+	 *
+	 * @method addField
+	 * @param fieldPath the path the evaluated expression will have in the result Document
+	 * @param pExpression the expression to evaluate obtain this field's Value in the result Document
+	 **/
 	proto.addField = function addField(fieldPath, pExpression){
 	proto.addField = function addField(fieldPath, pExpression){
 		if(!(fieldPath instanceof FieldPath)) fieldPath = new FieldPath(fieldPath);
 		if(!(fieldPath instanceof FieldPath)) fieldPath = new FieldPath(fieldPath);
 		var fieldPart = fieldPath.fields[0],
 		var fieldPart = fieldPath.fields[0],
@@ -253,23 +253,23 @@ var ObjectExpression = module.exports = (function(){
 	};
 	};
 
 
 	/**
 	/**
-	* Add a field path to the set of those to be included.
-	*
-	* Note that including a nested field implies including everything on the path leading down to it.
-	*
-	* @method includePath
-	* @param fieldPath the name of the field to be included
-	**/
+	 * Add a field path to the set of those to be included.
+	 *
+	 * Note that including a nested field implies including everything on the path leading down to it.
+	 *
+	 * @method includePath
+	 * @param fieldPath the name of the field to be included
+	 **/
 	proto.includePath = function includePath(path){
 	proto.includePath = function includePath(path){
 		this.addField(path, undefined);
 		this.addField(path, undefined);
 	};
 	};
 
 
 	/**
 	/**
-	* Get a count of the added fields.
-	*
-	* @method getFieldCount
-	* @returns how many fields have been added
-	**/
+	 * Get a count of the added fields.
+	 *
+	 * @method getFieldCount
+	 * @returns how many fields have been added
+	 **/
 	proto.getFieldCount = function getFieldCount(){
 	proto.getFieldCount = function getFieldCount(){
 		return Object.getOwnPropertyNames(this._expressions).length;
 		return Object.getOwnPropertyNames(this._expressions).length;
 	};
 	};

+ 5 - 5
lib/pipeline/expressions/OrExpression.js

@@ -5,10 +5,10 @@ var OrExpression = module.exports = (function(){
 	 *
 	 *
 	 * @see evaluate 
 	 * @see evaluate 
 	 * @class OrExpression
 	 * @class OrExpression
-	 * @namespace munge.pipeline.expressions
-	 * @module munge
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
 	 * @constructor
 	 * @constructor
-	**/
+	 **/
 	var klass = function OrExpression(){
 	var klass = function OrExpression(){
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		base.call(this);
 		base.call(this);
@@ -25,8 +25,8 @@ var OrExpression = module.exports = (function(){
 	};
 	};
 
 
 	/** 
 	/** 
-	* Takes an array of one or more values and returns true if any of the values in the array are true. Otherwise $or returns false. 
-	**/
+	 * Takes an array of one or more values and returns true if any of the values in the array are true. Otherwise $or returns false. 
+	 **/
 	proto.evaluate = function evaluate(doc){
 	proto.evaluate = function evaluate(doc){
 		for(var i = 0, n = this.operands.length; i < n; ++i){
 		for(var i = 0, n = this.operands.length; i < n; ++i){
 			var value = this.operands[i].evaluate(doc);
 			var value = this.operands[i].evaluate(doc);

+ 6 - 6
lib/pipeline/expressions/SecondExpression.js

@@ -5,10 +5,10 @@ var SecondExpression = module.exports = (function(){
 	 *
 	 *
 	 * @see evaluate 
 	 * @see evaluate 
 	 * @class SecondExpression
 	 * @class SecondExpression
-	 * @namespace munge.pipeline.expressions
-	 * @module munge
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
 	 * @constructor
 	 * @constructor
-	**/
+	 **/
 	var klass = function SecondExpression(){
 	var klass = function SecondExpression(){
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		base.call(this);
 		base.call(this);
@@ -25,9 +25,9 @@ var SecondExpression = module.exports = (function(){
 	};
 	};
 
 
 	/**
 	/**
-	* Takes a date and returns the second between 0 and 59, but can be 60 to account for leap seconds.
-	* @method evaluate
-	**/
+	 * Takes a date and returns the second between 0 and 59, but can be 60 to account for leap seconds.
+	 * @method evaluate
+	 **/
 	proto.evaluate = function evaluate(doc){
 	proto.evaluate = function evaluate(doc){
 		this.checkArgCount(1);
 		this.checkArgCount(1);
 		var date = this.operands[0].evaluate(doc);
 		var date = this.operands[0].evaluate(doc);

+ 2 - 2
lib/pipeline/expressions/StrcasecmpExpression.js

@@ -5,8 +5,8 @@ var StrcasecmpExpression = module.exports = (function(){
 	 *
 	 *
 	 * @see evaluate 
 	 * @see evaluate 
 	 * @class StrcasecmpExpression
 	 * @class StrcasecmpExpression
-	 * @namespace munge.pipeline.expressions
-	 * @module munge
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
 	 * @constructor
 	 * @constructor
 	**/
 	**/
 	var klass = function StrcasecmpExpression(){
 	var klass = function StrcasecmpExpression(){

+ 2 - 2
lib/pipeline/expressions/SubstrExpression.js

@@ -5,8 +5,8 @@ var SubstrExpression = module.exports = (function(){
 	 *
 	 *
 	 * @see evaluate 
 	 * @see evaluate 
 	 * @class SubstrExpression
 	 * @class SubstrExpression
-	 * @namespace munge.pipeline.expressions
-	 * @module munge
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
 	 * @constructor
 	 * @constructor
 	**/
 	**/
 	var klass = function SubstrExpression(){
 	var klass = function SubstrExpression(){

+ 2 - 2
lib/pipeline/expressions/SubtractExpression.js

@@ -5,8 +5,8 @@ var SubtractExpression = module.exports = (function(){
 	 *
 	 *
 	 * @see evaluate 
 	 * @see evaluate 
 	 * @class SubtractExpression
 	 * @class SubtractExpression
-	 * @namespace munge.pipeline.expressions
-	 * @module munge
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
 	 * @constructor
 	 * @constructor
 	**/
 	**/
 	var klass = function SubtractExpression(){
 	var klass = function SubtractExpression(){

+ 2 - 2
lib/pipeline/expressions/ToLowerExpression.js

@@ -5,8 +5,8 @@ var ToLowerExpression = module.exports = (function(){
 	 *
 	 *
 	 * @see evaluate 
 	 * @see evaluate 
 	 * @class ToLowerExpression
 	 * @class ToLowerExpression
-	 * @namespace munge.pipeline.expressions
-	 * @module munge
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
 	 * @constructor
 	 * @constructor
 	**/
 	**/
 	var klass = function ToLowerExpression(){
 	var klass = function ToLowerExpression(){

+ 2 - 2
lib/pipeline/expressions/ToUpperExpression.js

@@ -5,8 +5,8 @@ var ToUpperExpression = module.exports = (function(){
 	 *
 	 *
 	 * @see evaluate 
 	 * @see evaluate 
 	 * @class ToUpperExpression
 	 * @class ToUpperExpression
-	 * @namespace munge.pipeline.expressions
-	 * @module munge
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
 	 * @constructor
 	 * @constructor
 	**/
 	**/
 	var klass = function ToUpperExpression(){
 	var klass = function ToUpperExpression(){

+ 9 - 8
lib/pipeline/expressions/WeekExpression.js

@@ -5,10 +5,10 @@ var WeekExpression = module.exports = (function(){
 	 *
 	 *
 	 * @see evaluate 
 	 * @see evaluate 
 	 * @class WeekExpression
 	 * @class WeekExpression
-	 * @namespace munge.pipeline.expressions
-	 * @module munge
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
 	 * @constructor
 	 * @constructor
-	**/
+	 **/
 	var klass = function WeekExpression(){
 	var klass = function WeekExpression(){
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		base.call(this);
 		base.call(this);
@@ -29,11 +29,12 @@ var WeekExpression = module.exports = (function(){
 	};
 	};
 
 
 	/** 
 	/** 
-	* Takes a date and returns the week of the year as a number between 0 and 53. 
-	* Weeks begin on Sundays, and week 1 begins with the first Sunday of the year. 
-	* Days preceding the first Sunday of the year are in week 0. 
-	* This behavior is the same as the “%U” operator to the strftime standard library function.
-	**/
+	 * Takes a date and returns the week of the year as a number between 0 and 53. 
+	 * Weeks begin on Sundays, and week 1 begins with the first Sunday of the year. 
+	 * Days preceding the first Sunday of the year are in week 0. 
+	 * This behavior is the same as the “%U” operator to the strftime standard library function.
+	 * @method evaluate
+	 **/
 	proto.evaluate = function evaluate(doc) {
 	proto.evaluate = function evaluate(doc) {
 		this.checkArgCount(1);
 		this.checkArgCount(1);
 		var date = this.operands[0].evaluate(doc),
 		var date = this.operands[0].evaluate(doc),

+ 6 - 6
lib/pipeline/expressions/YearExpression.js

@@ -5,10 +5,10 @@ var YearExpression = module.exports = (function(){
 	 *
 	 *
 	 * @see evaluate 
 	 * @see evaluate 
 	 * @class YearExpression
 	 * @class YearExpression
-	 * @namespace munge.pipeline.expressions
-	 * @module munge
+	 * @namespace mungedb.aggregate.pipeline.expressions
+	 * @module mungedb-aggregate
 	 * @constructor
 	 * @constructor
-	**/
+	 **/
 	var klass = function YearExpression(){
 	var klass = function YearExpression(){
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		if(arguments.length !== 0) throw new Error("zero args expected");
 		base.call(this);
 		base.call(this);
@@ -29,9 +29,9 @@ var YearExpression = module.exports = (function(){
 	};
 	};
 
 
 	/**
 	/**
-	* Takes a date and returns the full year.
-	* @method evaluate
-	**/
+	 * Takes a date and returns the full year.
+	 * @method evaluate
+	 **/
 	proto.evaluate = function evaluate(doc) {
 	proto.evaluate = function evaluate(doc) {
 		this.checkArgCount(1);
 		this.checkArgCount(1);
 		var date = this.operands[0].evaluate(doc);
 		var date = this.operands[0].evaluate(doc);

+ 0 - 1
munge.js

@@ -1 +0,0 @@
-module.exports = require("./lib/munge");

+ 1 - 0
mungedb-aggregate.js

@@ -0,0 +1 @@
+module.exports = require("./lib/");

+ 1 - 1
package.json

@@ -10,7 +10,7 @@
 		"Spencer Rathbun <SRathbun@riverainc.com>",
 		"Spencer Rathbun <SRathbun@riverainc.com>",
 		"Charles Ezell <CEzell@riverainc.com>"
 		"Charles Ezell <CEzell@riverainc.com>"
 	],
 	],
-	"main": "./munge.js",
+	"main": "./mungedb-aggregate.js",
 	"scripts": {
 	"scripts": {
 		"test": "npm_scripts/test/test.sh"
 		"test": "npm_scripts/test/test.sh"
 	},
 	},

+ 2 - 1
test/lib/Cursor.js

@@ -1,3 +1,4 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	Cursor = require("../../lib/Cursor");
 	Cursor = require("../../lib/Cursor");
 
 
@@ -89,4 +90,4 @@ module.exports = {
 
 
 };
 };
 
 
-if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run();
+if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run();

+ 47 - 46
test/lib/munge.js → test/lib/aggregate.js

@@ -1,20 +1,21 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
-	munge = require("../../");
+	aggregate = require("../../");
 
 
 module.exports = {
 module.exports = {
 
 
-	"munge": {
+	"aggregate": {
 
 
 		"should be able to use an empty pipeline (no-op)": function(){
 		"should be able to use an empty pipeline (no-op)": function(){
 			var i = [1, 2, 3],
 			var i = [1, 2, 3],
 				p = [],
 				p = [],
 				e = [1, 2, 3],
 				e = [1, 2, 3],
-				munger = munge(p),
-				a = munger(i);
+				aggregater = aggregate(p),
+				a = aggregater(i);
 			assert.equal(JSON.stringify(a), JSON.stringify(e), "Unexpected value!");
 			assert.equal(JSON.stringify(a), JSON.stringify(e), "Unexpected value!");
 			assert.deepEqual(a, e, "Unexpected value (not deepEqual)!");
 			assert.deepEqual(a, e, "Unexpected value (not deepEqual)!");
-			assert.equal(JSON.stringify(munger(i)), JSON.stringify(e), "Reuse of munger should yield the same results!");
-			assert.equal(JSON.stringify(munge(p, i)), JSON.stringify(e), "Alternate use of munge should yield the same results!");
+			assert.equal(JSON.stringify(aggregater(i)), JSON.stringify(e), "Reuse of aggregater should yield the same results!");
+			assert.equal(JSON.stringify(aggregate(p, i)), JSON.stringify(e), "Alternate use of aggregate should yield the same results!");
 		},
 		},
 
 
 
 
@@ -22,47 +23,47 @@ module.exports = {
 			var i = [{_id:0}, {_id:1}, {_id:2}, {_id:3}, {_id:4}, {_id:5}],
 			var i = [{_id:0}, {_id:1}, {_id:2}, {_id:3}, {_id:4}, {_id:5}],
 				p = [{$limit:2}],
 				p = [{$limit:2}],
 				e = [{_id:0}, {_id:1}],
 				e = [{_id:0}, {_id:1}],
-				munger = munge(p),
-				a = munger(i);
+				aggregater = aggregate(p),
+				a = aggregater(i);
 			assert.equal(JSON.stringify(a), JSON.stringify(e), "Unexpected value!");
 			assert.equal(JSON.stringify(a), JSON.stringify(e), "Unexpected value!");
 			assert.deepEqual(a, e, "Unexpected value (not deepEqual)!");
 			assert.deepEqual(a, e, "Unexpected value (not deepEqual)!");
-			assert.equal(JSON.stringify(munger(i)), JSON.stringify(e), "Reuse of munger should yield the same results!");
-			assert.equal(JSON.stringify(munge(p, i)), JSON.stringify(e), "Alternate use of munge should yield the same results!");
+			assert.equal(JSON.stringify(aggregater(i)), JSON.stringify(e), "Reuse of aggregater should yield the same results!");
+			assert.equal(JSON.stringify(aggregate(p, i)), JSON.stringify(e), "Alternate use of aggregate should yield the same results!");
 		},
 		},
 
 
 		"should be able to use a $match operator": function(){
 		"should be able to use a $match operator": function(){
 			var i = [{_id:0, e:1}, {_id:1, e:0}, {_id:2, e:1}, {_id:3, e:0}, {_id:4, e:1}, {_id:5, e:0}],
 			var i = [{_id:0, e:1}, {_id:1, e:0}, {_id:2, e:1}, {_id:3, e:0}, {_id:4, e:1}, {_id:5, e:0}],
 				p = [{$match:{e:1}}],
 				p = [{$match:{e:1}}],
 				e = [{_id:0, e:1}, {_id:2, e:1}, {_id:4, e:1}],
 				e = [{_id:0, e:1}, {_id:2, e:1}, {_id:4, e:1}],
-				munger = munge(p),
-				a = munger(i);
+				aggregater = aggregate(p),
+				a = aggregater(i);
 			assert.equal(JSON.stringify(a), JSON.stringify(e), "Unexpected value!");
 			assert.equal(JSON.stringify(a), JSON.stringify(e), "Unexpected value!");
 			assert.deepEqual(a, e, "Unexpected value (not deepEqual)!");
 			assert.deepEqual(a, e, "Unexpected value (not deepEqual)!");
-			assert.equal(JSON.stringify(munger(i)), JSON.stringify(e), "Reuse of munger should yield the same results!");
-			assert.equal(JSON.stringify(munge(p, i)), JSON.stringify(e), "Alternate use of munge should yield the same results!");
+			assert.equal(JSON.stringify(aggregater(i)), JSON.stringify(e), "Reuse of aggregater should yield the same results!");
+			assert.equal(JSON.stringify(aggregate(p, i)), JSON.stringify(e), "Alternate use of aggregate should yield the same results!");
 		},
 		},
 		
 		
 		"should be able to use a $skip operator": function(){
 		"should be able to use a $skip operator": function(){
 			var i = [{_id:0}, {_id:1}, {_id:2}, {_id:3}, {_id:4}, {_id:5}],
 			var i = [{_id:0}, {_id:1}, {_id:2}, {_id:3}, {_id:4}, {_id:5}],
 				p = [{$skip:2}, {$skip:1}],	//testing w/ 2 ensures independent state variables
 				p = [{$skip:2}, {$skip:1}],	//testing w/ 2 ensures independent state variables
 				e = [{_id:3}, {_id:4}, {_id:5}],
 				e = [{_id:3}, {_id:4}, {_id:5}],
-				munger = munge(p),
-				a = munger(i);
+				aggregater = aggregate(p),
+				a = aggregater(i);
 			assert.equal(JSON.stringify(a), JSON.stringify(e), "Unexpected value!");
 			assert.equal(JSON.stringify(a), JSON.stringify(e), "Unexpected value!");
 			assert.deepEqual(a, e, "Unexpected value (not deepEqual)!");
 			assert.deepEqual(a, e, "Unexpected value (not deepEqual)!");
-			assert.equal(JSON.stringify(munger(i)), JSON.stringify(e), "Reuse of munger should yield the same results!");
-			assert.equal(JSON.stringify(munge(p, i)), JSON.stringify(e), "Alternate use of munge should yield the same results!");
+			assert.equal(JSON.stringify(aggregater(i)), JSON.stringify(e), "Reuse of aggregater should yield the same results!");
+			assert.equal(JSON.stringify(aggregate(p, i)), JSON.stringify(e), "Alternate use of aggregate should yield the same results!");
 		},
 		},
 		"should be able to use a $skip and then a $limit operator together in the same pipeline": function(){
 		"should be able to use a $skip and then a $limit operator together in the same pipeline": function(){
 			var i = [{_id:0, e:1}, {_id:1, e:0}, {_id:2, e:1}, {_id:3, e:0}, {_id:4, e:1}, {_id:5, e:0}],
 			var i = [{_id:0, e:1}, {_id:1, e:0}, {_id:2, e:1}, {_id:3, e:0}, {_id:4, e:1}, {_id:5, e:0}],
 				p = [{$skip:2}, {$limit:1}],
 				p = [{$skip:2}, {$limit:1}],
 				e = [{_id:2, e:1}],
 				e = [{_id:2, e:1}],
-				munger = munge(p),
-				a = munger(i);
+				aggregater = aggregate(p),
+				a = aggregater(i);
 			assert.equal(JSON.stringify(a), JSON.stringify(e), "Unexpected value!");
 			assert.equal(JSON.stringify(a), JSON.stringify(e), "Unexpected value!");
 			assert.deepEqual(a, e, "Unexpected value (not deepEqual)!");
 			assert.deepEqual(a, e, "Unexpected value (not deepEqual)!");
-			assert.equal(JSON.stringify(munger(i)), JSON.stringify(e), "Reuse of munger should yield the same results!");
-			assert.equal(JSON.stringify(munge(p, i)), JSON.stringify(e), "Alternate use of munge should yield the same results!");
+			assert.equal(JSON.stringify(aggregater(i)), JSON.stringify(e), "Reuse of aggregater should yield the same results!");
+			assert.equal(JSON.stringify(aggregate(p, i)), JSON.stringify(e), "Alternate use of aggregate should yield the same results!");
 		},
 		},
 
 
 		"should be able to construct an instance with $unwind operators properly": function(){
 		"should be able to construct an instance with $unwind operators properly": function(){
@@ -83,12 +84,12 @@ module.exports = {
 					{_id:0,nodes:{one:[1,1],two:22}},
 					{_id:0,nodes:{one:[1,1],two:22}},
 					{_id:1,nodes:{two:22,three:[333]}}
 					{_id:1,nodes:{two:22,three:[333]}}
 				],
 				],
-				munger = munge(p),
-				a = munger(i);
+				aggregater = aggregate(p),
+				a = aggregater(i);
 			assert.equal(JSON.stringify(a), JSON.stringify(e), "Unexpected value!");
 			assert.equal(JSON.stringify(a), JSON.stringify(e), "Unexpected value!");
 			assert.deepEqual(a, e, "Unexpected value (not deepEqual)!");
 			assert.deepEqual(a, e, "Unexpected value (not deepEqual)!");
-			assert.equal(JSON.stringify(munger(i)), JSON.stringify(e), "Reuse of munger should yield the same results!");
-			assert.equal(JSON.stringify(munge(p, i)), JSON.stringify(e), "Alternate use of munge should yield the same results!");
+			assert.equal(JSON.stringify(aggregater(i)), JSON.stringify(e), "Reuse of aggregater should yield the same results!");
+			assert.equal(JSON.stringify(aggregate(p, i)), JSON.stringify(e), "Alternate use of aggregate should yield the same results!");
 		},
 		},
 
 
 
 
@@ -101,11 +102,11 @@ module.exports = {
 						//TODO: high level test of all other expression operators
 						//TODO: high level test of all other expression operators
 					}}],
 					}}],
 				e = [{_id:0, e:1, b:"not two", a:2}, {_id:2, e:2, b:"two", a:4}, {_id:4, e:3, b:"not two", a:6}],
 				e = [{_id:0, e:1, b:"not two", a:2}, {_id:2, e:2, b:"two", a:4}, {_id:4, e:3, b:"not two", a:6}],
-				munger = munge(p),
-				a = munger(i);
+				aggregater = aggregate(p),
+				a = aggregater(i);
 			assert.deepEqual(a, e, "Unexpected value (not deepEqual)!");
 			assert.deepEqual(a, e, "Unexpected value (not deepEqual)!");
-			assert.deepEqual(munger(i), e, "Reuse of munger should yield the same results!");
-			assert.deepEqual(munge(p, i), e, "Alternate use of munge should yield the same results!");
+			assert.deepEqual(aggregater(i), e, "Reuse of aggregater should yield the same results!");
+			assert.deepEqual(aggregate(p, i), e, "Alternate use of aggregate should yield the same results!");
 		},
 		},
 		
 		
 		
 		
@@ -117,11 +118,11 @@ module.exports = {
 						//TODO: high level test of all other expression operators
 						//TODO: high level test of all other expression operators
 					}}],
 					}}],
 				e = [{e:1}, {e:2}, {e:3}],
 				e = [{e:1}, {e:2}, {e:3}],
-				munger = munge(p),
-				a = munger(i);
+				aggregater = aggregate(p),
+				a = aggregater(i);
 			assert.deepEqual(a, e, "Unexpected value (not deepEqual)!");
 			assert.deepEqual(a, e, "Unexpected value (not deepEqual)!");
-			assert.deepEqual(munger(i), e, "Reuse of munger should yield the same results!");
-			assert.deepEqual(munge(p, i), e, "Alternate use of munge should yield the same results!");
+			assert.deepEqual(aggregater(i), e, "Reuse of aggregater should yield the same results!");
+			assert.deepEqual(aggregate(p, i), e, "Alternate use of aggregate should yield the same results!");
 		},
 		},
 
 
 		"should be able to construct an instance with $sort operators properly (ascending)": function(){
 		"should be able to construct an instance with $sort operators properly (ascending)": function(){
@@ -135,12 +136,12 @@ module.exports = {
 						{_id:null}, {_id:NaN},
 						{_id:null}, {_id:NaN},
 						{_id:-273.15}, {_id:1}, {_id:3.14159}, {_id:11}, {_id:42}
 						{_id:-273.15}, {_id:1}, {_id:3.14159}, {_id:11}, {_id:42}
 					],
 					],
-				munger = munge(p),
-				a = munger(i);
+				aggregater = aggregate(p),
+				a = aggregater(i);
 			assert.equal(JSON.stringify(a), JSON.stringify(e), "Unexpected value!");
 			assert.equal(JSON.stringify(a), JSON.stringify(e), "Unexpected value!");
 			//assert.deepEqual(a, e); //does not work with NaN
 			//assert.deepEqual(a, e); //does not work with NaN
-			assert.equal(JSON.stringify(munger(i)), JSON.stringify(e), "Reuse of munger should yield the same results!");
-			assert.equal(JSON.stringify(munge(p, i)), JSON.stringify(e), "Alternate use of munge should yield the same results!");
+			assert.equal(JSON.stringify(aggregater(i)), JSON.stringify(e), "Reuse of aggregater should yield the same results!");
+			assert.equal(JSON.stringify(aggregate(p, i)), JSON.stringify(e), "Alternate use of aggregate should yield the same results!");
 		},
 		},
 		"should be able to construct an instance with $group operators properly": function(){
 		"should be able to construct an instance with $group operators properly": function(){
 			var i = [
 			var i = [
@@ -190,12 +191,12 @@ module.exports = {
 							push_b:["a", "b", "b", "c"]
 							push_b:["a", "b", "b", "c"]
 						}
 						}
 					],
 					],
-				munger = munge(p),
-				a = munger(i);
+				aggregater = aggregate(p),
+				a = aggregater(i);
 			assert.equal(JSON.stringify(a), JSON.stringify(e), "Unexpected value!");
 			assert.equal(JSON.stringify(a), JSON.stringify(e), "Unexpected value!");
 			//assert.deepEqual(a, e); //does not work with NaN
 			//assert.deepEqual(a, e); //does not work with NaN
-			assert.equal(JSON.stringify(munger(i)), JSON.stringify(e), "Reuse of munger should yield the same results!");
-			assert.equal(JSON.stringify(munge(p, i)), JSON.stringify(e), "Alternate use of munge should yield the same results!");
+			assert.equal(JSON.stringify(aggregater(i)), JSON.stringify(e), "Reuse of aggregater should yield the same results!");
+			assert.equal(JSON.stringify(aggregate(p, i)), JSON.stringify(e), "Alternate use of aggregate should yield the same results!");
 		},
 		},
 
 
 		"should be able to use a $split operator": function(){
 		"should be able to use a $split operator": function(){
@@ -203,12 +204,12 @@ module.exports = {
 				p = [{$match:{_id:0}}, {$split:{aX2:[{$project:{a:{$multiply:["$a", 2]}}}], aX3:[{$project:{a:{$multiply:["$a", 3]}}}]}}, {$unwind:"$aX2"}, {$unwind:"$aX3"}],
 				p = [{$match:{_id:0}}, {$split:{aX2:[{$project:{a:{$multiply:["$a", 2]}}}], aX3:[{$project:{a:{$multiply:["$a", 3]}}}]}}, {$unwind:"$aX2"}, {$unwind:"$aX3"}],
 				//e = [{aX2:[{_id:0, a:2}], aX3:[{_id:0, a:3}]}],
 				//e = [{aX2:[{_id:0, a:2}], aX3:[{_id:0, a:3}]}],
 				e = [{aX2:{_id:0, a:2}, aX3:{_id:0, a:3}}],
 				e = [{aX2:{_id:0, a:2}, aX3:{_id:0, a:3}}],
-				munger = munge(p),
-				a = munger(i);
+				aggregater = aggregate(p),
+				a = aggregater(i);
 			assert.equal(JSON.stringify(a), JSON.stringify(e), "Unexpected value!");
 			assert.equal(JSON.stringify(a), JSON.stringify(e), "Unexpected value!");
 			assert.deepEqual(a, e, "Unexpected value (not deepEqual)!");
 			assert.deepEqual(a, e, "Unexpected value (not deepEqual)!");
-			assert.equal(JSON.stringify(munger(i)), JSON.stringify(e), "Reuse of munger should yield the same results!");
-			assert.equal(JSON.stringify(munge(p, i)), JSON.stringify(e), "Alternate use of munge should yield the same results!");
+			assert.equal(JSON.stringify(aggregater(i)), JSON.stringify(e), "Reuse of aggregater should yield the same results!");
+			assert.equal(JSON.stringify(aggregate(p, i)), JSON.stringify(e), "Alternate use of aggregate should yield the same results!");
 		},
 		},
 
 
 	}
 	}

+ 2 - 0
test/lib/pipeline/FieldPath.js

@@ -1,6 +1,8 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	FieldPath = require("../../../lib/pipeline/FieldPath");
 	FieldPath = require("../../../lib/pipeline/FieldPath");
 
 
+
 module.exports = {
 module.exports = {
 
 
 	"FieldPath": {
 	"FieldPath": {

+ 2 - 2
test/lib/pipeline/Pipeline.js

@@ -1,8 +1,8 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	Pipeline = require("../../../lib/pipeline/Pipeline");
 	Pipeline = require("../../../lib/pipeline/Pipeline");
 
 
 
 
-
 module.exports = {
 module.exports = {
 
 
 	"Pipeline": {
 	"Pipeline": {
@@ -118,4 +118,4 @@ module.exports = {
 
 
 };
 };
 
 
-if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run();
+if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run();

+ 2 - 2
test/lib/pipeline/PipelineD.js

@@ -1,3 +1,4 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	Pipeline = require("../../../lib/pipeline/Pipeline"),
 	Pipeline = require("../../../lib/pipeline/Pipeline"),
 	PipelineD = require("../../../lib/pipeline/PipelineD"),
 	PipelineD = require("../../../lib/pipeline/PipelineD"),
@@ -5,7 +6,6 @@ var assert = require("assert"),
 	CursorDocumentSource = require('../../../lib/pipeline/documentSources/CursorDocumentSource');
 	CursorDocumentSource = require('../../../lib/pipeline/documentSources/CursorDocumentSource');
 
 
 
 
-
 module.exports = {
 module.exports = {
 
 
 	"Pipeline": {
 	"Pipeline": {
@@ -105,4 +105,4 @@ module.exports = {
 
 
 };
 };
 
 
-if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run();
+if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run();

+ 3 - 0
test/lib/pipeline/accumulators/AddToSetAccumulator.js

@@ -1,14 +1,17 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	AddToSetAccumulator = require("../../../../lib/pipeline/accumulators/AddToSetAccumulator"),
 	AddToSetAccumulator = require("../../../../lib/pipeline/accumulators/AddToSetAccumulator"),
 	ConstantExpression = require("../../../../lib/pipeline/expressions/ConstantExpression"),
 	ConstantExpression = require("../../../../lib/pipeline/expressions/ConstantExpression"),
 	FieldPathExpression = require("../../../../lib/pipeline/expressions/FieldPathExpression");
 	FieldPathExpression = require("../../../../lib/pipeline/expressions/FieldPathExpression");
 
 
+
 var createAccumulator = function createAccumulator() {
 var createAccumulator = function createAccumulator() {
 	var myAccumulator = new AddToSetAccumulator();
 	var myAccumulator = new AddToSetAccumulator();
 	myAccumulator.addOperand(new FieldPathExpression("b") );
 	myAccumulator.addOperand(new FieldPathExpression("b") );
 	return myAccumulator;
 	return myAccumulator;
 };
 };
 
 
+
 //TODO: refactor these test cases using Expression.parseOperand() or something because these could be a whole lot cleaner...
 //TODO: refactor these test cases using Expression.parseOperand() or something because these could be a whole lot cleaner...
 module.exports = {
 module.exports = {
 
 

+ 1 - 1
test/lib/pipeline/accumulators/AvgAccumulator.js

@@ -1,3 +1,4 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	AvgAccumulator = require("../../../../lib/pipeline/accumulators/AvgAccumulator"),
 	AvgAccumulator = require("../../../../lib/pipeline/accumulators/AvgAccumulator"),
 	FieldPathExpression = require("../../../../lib/pipeline/expressions/FieldPathExpression");
 	FieldPathExpression = require("../../../../lib/pipeline/expressions/FieldPathExpression");
@@ -114,4 +115,3 @@ module.exports = {
 };
 };
 
 
 if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
 if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
-

+ 3 - 1
test/lib/pipeline/accumulators/FirstAccumulator.js

@@ -1,13 +1,16 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	FirstAccumulator = require("../../../../lib/pipeline/accumulators/FirstAccumulator"),
 	FirstAccumulator = require("../../../../lib/pipeline/accumulators/FirstAccumulator"),
 	FieldPathExpression = require("../../../../lib/pipeline/expressions/FieldPathExpression");
 	FieldPathExpression = require("../../../../lib/pipeline/expressions/FieldPathExpression");
 
 
+
 function createAccumulator(){
 function createAccumulator(){
 	var firstAccumulator = new FirstAccumulator();
 	var firstAccumulator = new FirstAccumulator();
 	firstAccumulator.addOperand(new FieldPathExpression("a") );
 	firstAccumulator.addOperand(new FieldPathExpression("a") );
 	return firstAccumulator;
 	return firstAccumulator;
 }
 }
 
 
+
 module.exports = {
 module.exports = {
 
 
 	"FirstAccumulator": {
 	"FirstAccumulator": {
@@ -78,4 +81,3 @@ module.exports = {
 };
 };
 
 
 if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
 if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
-

+ 1 - 0
test/lib/pipeline/accumulators/LastAccumulator.js

@@ -1,3 +1,4 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	LastAccumulator = require("../../../../lib/pipeline/accumulators/LastAccumulator"),
 	LastAccumulator = require("../../../../lib/pipeline/accumulators/LastAccumulator"),
 	FieldPathExpression = require("../../../../lib/pipeline/expressions/FieldPathExpression");
 	FieldPathExpression = require("../../../../lib/pipeline/expressions/FieldPathExpression");

+ 3 - 1
test/lib/pipeline/accumulators/MaxAccumulator.js

@@ -1,13 +1,16 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	MaxAccumulator = require("../../../../lib/pipeline/accumulators/MinMaxAccumulator"),
 	MaxAccumulator = require("../../../../lib/pipeline/accumulators/MinMaxAccumulator"),
 	FieldPathExpression = require("../../../../lib/pipeline/expressions/FieldPathExpression");
 	FieldPathExpression = require("../../../../lib/pipeline/expressions/FieldPathExpression");
 
 
+
 function createAccumulator(){
 function createAccumulator(){
 	var maxAccumulator = MaxAccumulator.createMax();
 	var maxAccumulator = MaxAccumulator.createMax();
 	maxAccumulator.addOperand(new FieldPathExpression("a") );
 	maxAccumulator.addOperand(new FieldPathExpression("a") );
 	return maxAccumulator;
 	return maxAccumulator;
 }
 }
 
 
+
 module.exports = {
 module.exports = {
 
 
 	"MaxAccumulator": {
 	"MaxAccumulator": {
@@ -77,4 +80,3 @@ module.exports = {
 };
 };
 
 
 if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
 if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
-

+ 3 - 1
test/lib/pipeline/accumulators/MinAccumulator.js

@@ -1,13 +1,16 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	MinAccumulator = require("../../../../lib/pipeline/accumulators/MinMaxAccumulator"),
 	MinAccumulator = require("../../../../lib/pipeline/accumulators/MinMaxAccumulator"),
 	FieldPathExpression = require("../../../../lib/pipeline/expressions/FieldPathExpression");
 	FieldPathExpression = require("../../../../lib/pipeline/expressions/FieldPathExpression");
 
 
+
 function createAccumulator(){
 function createAccumulator(){
 	var minAccumulator = MinAccumulator.createMin();
 	var minAccumulator = MinAccumulator.createMin();
 	minAccumulator.addOperand(new FieldPathExpression("a") );
 	minAccumulator.addOperand(new FieldPathExpression("a") );
 	return minAccumulator;
 	return minAccumulator;
 }
 }
 
 
+
 module.exports = {
 module.exports = {
 
 
 	"MinAccumulator": {
 	"MinAccumulator": {
@@ -77,4 +80,3 @@ module.exports = {
 };
 };
 
 
 if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
 if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
-

+ 1 - 2
test/lib/pipeline/accumulators/PushAccumulator.js

@@ -1,3 +1,4 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	PushAccumulator = require("../../../../lib/pipeline/accumulators/PushAccumulator"),
 	PushAccumulator = require("../../../../lib/pipeline/accumulators/PushAccumulator"),
 	FieldPathExpression = require("../../../../lib/pipeline/expressions/FieldPathExpression");
 	FieldPathExpression = require("../../../../lib/pipeline/expressions/FieldPathExpression");
@@ -68,5 +69,3 @@ module.exports = {
 };
 };
 
 
 if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
 if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
-
-

+ 2 - 0
test/lib/pipeline/accumulators/SingleValueAccumulator.js

@@ -1,6 +1,8 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	SingleValueAccumulator = require("../../../../lib/pipeline/accumulators/SingleValueAccumulator");
 	SingleValueAccumulator = require("../../../../lib/pipeline/accumulators/SingleValueAccumulator");
 
 
+
 //TODO: refactor these test cases using Expression.parseOperand() or something because these could be a whole lot cleaner...
 //TODO: refactor these test cases using Expression.parseOperand() or something because these could be a whole lot cleaner...
 module.exports = {
 module.exports = {
 
 

+ 1 - 1
test/lib/pipeline/accumulators/SumAccumulator.js

@@ -1,3 +1,4 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	SumAccumulator = require("../../../../lib/pipeline/accumulators/SumAccumulator"),
 	SumAccumulator = require("../../../../lib/pipeline/accumulators/SumAccumulator"),
 	FieldPathExpression = require("../../../../lib/pipeline/expressions/FieldPathExpression");
 	FieldPathExpression = require("../../../../lib/pipeline/expressions/FieldPathExpression");
@@ -114,4 +115,3 @@ module.exports = {
 };
 };
 
 
 if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
 if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
-

+ 3 - 1
test/lib/pipeline/documentSources/CursorDocumentSource.js

@@ -1,7 +1,9 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	CursorDocumentSource = require("../../../../lib/pipeline/documentSources/CursorDocumentSource"),
 	CursorDocumentSource = require("../../../../lib/pipeline/documentSources/CursorDocumentSource"),
 	Cursor = require("../../../../lib/Cursor");
 	Cursor = require("../../../../lib/Cursor");
 
 
+
 module.exports = {
 module.exports = {
 
 
 	"CursorDocumentSource": {
 	"CursorDocumentSource": {
@@ -95,4 +97,4 @@ module.exports = {
 
 
 };
 };
 
 
-if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run();
+if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run();

+ 1 - 6
test/lib/pipeline/documentSources/FilterBaseDocumentSource.js

@@ -1,11 +1,7 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	FilterBaseDocumentSource = require("../../../../lib/pipeline/documentSources/FilterBaseDocumentSource");
 	FilterBaseDocumentSource = require("../../../../lib/pipeline/documentSources/FilterBaseDocumentSource");
 
 
-function createSource(){
-	var fbds = new FilterBaseDocumentSource();
-	fbds.addOperand(new FieldPathExpression("a") );
-	return fbds;
-}
 
 
 /**
 /**
  * none of the rest of this class can be tested, since all the methods depend on 
  * none of the rest of this class can be tested, since all the methods depend on 
@@ -53,4 +49,3 @@ module.exports = {
 };
 };
 
 
 if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
 if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
-

+ 2 - 3
test/lib/pipeline/documentSources/GroupDocumentSource.js

@@ -1,3 +1,4 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	CursorDocumentSource = require("../../../../lib/pipeline/documentSources/CursorDocumentSource"),
 	CursorDocumentSource = require("../../../../lib/pipeline/documentSources/CursorDocumentSource"),
 	Cursor = require("../../../../lib/Cursor"),
 	Cursor = require("../../../../lib/Cursor"),
@@ -32,9 +33,9 @@ function assertExpectedResult(args) {
 				GroupDocumentSource.createFromJson(args.spec);
 				GroupDocumentSource.createFromJson(args.spec);
 			});
 			});
 	}
 	}
-
 }
 }
 
 
+
 module.exports = {
 module.exports = {
 
 
 	"GroupDocumentSource": {
 	"GroupDocumentSource": {
@@ -192,5 +193,3 @@ module.exports = {
 };
 };
 
 
 if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
 if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
-
-

+ 2 - 1
test/lib/pipeline/documentSources/LimitDocumentSource.js

@@ -1,6 +1,8 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	LimitDocumentSource = require("../../../../lib/pipeline/documentSources/LimitDocumentSource");
 	LimitDocumentSource = require("../../../../lib/pipeline/documentSources/LimitDocumentSource");
 
 
+
 module.exports = {
 module.exports = {
 
 
 	"LimitDocumentSource": {
 	"LimitDocumentSource": {
@@ -157,4 +159,3 @@ module.exports = {
 };
 };
 
 
 if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
 if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
-

+ 2 - 1
test/lib/pipeline/documentSources/MatchDocumentSource.js

@@ -1,6 +1,8 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	MatchDocumentSource = require("../../../../lib/pipeline/documentSources/MatchDocumentSource");
 	MatchDocumentSource = require("../../../../lib/pipeline/documentSources/MatchDocumentSource");
 
 
+
 module.exports = {
 module.exports = {
 
 
 	"MatchDocumentSource": {
 	"MatchDocumentSource": {
@@ -72,4 +74,3 @@ module.exports = {
 };
 };
 
 
 if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
 if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
-

+ 7 - 5
test/lib/pipeline/documentSources/ProjectDocumentSource.js

@@ -1,9 +1,10 @@
-
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
-DocumentSource = require("../../../../lib/pipeline/documentSources/DocumentSource"),
-ProjectDocumentSource = require("../../../../lib/pipeline/documentSources/ProjectDocumentSource"),
-CursorDocumentSource = require("../../../../lib/pipeline/documentSources/CursorDocumentSource"),
-Cursor = require("../../../../lib/Cursor");
+	DocumentSource = require("../../../../lib/pipeline/documentSources/DocumentSource"),
+	ProjectDocumentSource = require("../../../../lib/pipeline/documentSources/ProjectDocumentSource"),
+	CursorDocumentSource = require("../../../../lib/pipeline/documentSources/CursorDocumentSource"),
+	Cursor = require("../../../../lib/Cursor");
+
 
 
 //HELPERS
 //HELPERS
 var assertExhausted = function assertExhausted(pds) {
 var assertExhausted = function assertExhausted(pds) {
@@ -33,6 +34,7 @@ var createProject = function createProject(projection) {
     return project;
     return project;
 };
 };
 
 
+
 //TESTS
 //TESTS
 module.exports = {
 module.exports = {
 
 

+ 2 - 1
test/lib/pipeline/documentSources/SkipDocumentSource.js

@@ -1,6 +1,8 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	SkipDocumentSource = require("../../../../lib/pipeline/documentSources/SkipDocumentSource");
 	SkipDocumentSource = require("../../../../lib/pipeline/documentSources/SkipDocumentSource");
 
 
+
 module.exports = {
 module.exports = {
 
 
 	"SkipDocumentSource": {
 	"SkipDocumentSource": {
@@ -155,4 +157,3 @@ module.exports = {
 };
 };
 
 
 if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
 if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
-

+ 2 - 1
test/lib/pipeline/documentSources/SortDocumentSource.js

@@ -1,9 +1,11 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	SortDocumentSource = require("../../../../lib/pipeline/documentSources/SortDocumentSource"),
 	SortDocumentSource = require("../../../../lib/pipeline/documentSources/SortDocumentSource"),
 	CursorDocumentSource = require("../../../../lib/pipeline/documentSources/CursorDocumentSource"),
 	CursorDocumentSource = require("../../../../lib/pipeline/documentSources/CursorDocumentSource"),
 	Cursor = require("../../../../lib/Cursor"),
 	Cursor = require("../../../../lib/Cursor"),
 	FieldPathExpression = require("../../../../lib/pipeline/expressions/FieldPathExpression");
 	FieldPathExpression = require("../../../../lib/pipeline/expressions/FieldPathExpression");
 
 
+
 module.exports = {
 module.exports = {
 
 
 	"SortDocumentSource": {
 	"SortDocumentSource": {
@@ -347,4 +349,3 @@ module.exports = {
 };
 };
 
 
 if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
 if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
-

+ 1 - 0
test/lib/pipeline/documentSources/SplitDocumentSource.js

@@ -1,3 +1,4 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	SplitDocumentSource = require("../../../../lib/pipeline/documentSources/SplitDocumentSource"),
 	SplitDocumentSource = require("../../../../lib/pipeline/documentSources/SplitDocumentSource"),
 	CursorDocumentSource = require("../../../../lib/pipeline/documentSources/CursorDocumentSource"),
 	CursorDocumentSource = require("../../../../lib/pipeline/documentSources/CursorDocumentSource"),

+ 7 - 5
test/lib/pipeline/documentSources/UnwindDocumentSource.js

@@ -1,9 +1,10 @@
-
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
-DocumentSource = require("../../../../lib/pipeline/documentSources/DocumentSource"),
-UnwindDocumentSource = require("../../../../lib/pipeline/documentSources/UnwindDocumentSource"),
-CursorDocumentSource = require("../../../../lib/pipeline/documentSources/CursorDocumentSource"),
-Cursor = require("../../../../lib/Cursor");
+	DocumentSource = require("../../../../lib/pipeline/documentSources/DocumentSource"),
+	UnwindDocumentSource = require("../../../../lib/pipeline/documentSources/UnwindDocumentSource"),
+	CursorDocumentSource = require("../../../../lib/pipeline/documentSources/CursorDocumentSource"),
+	Cursor = require("../../../../lib/Cursor");
+
 
 
 //HELPERS
 //HELPERS
 var assertExhausted = function assertExhausted(pds) {
 var assertExhausted = function assertExhausted(pds) {
@@ -71,6 +72,7 @@ var throwsException = function throwsException(data, path, expectedResults){
 	});
 	});
 };
 };
 
 
+
 //TESTS
 //TESTS
 module.exports = {
 module.exports = {
 
 

+ 3 - 1
test/lib/pipeline/expressions/AddExpression.js

@@ -1,7 +1,9 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	AddExpression = require("../../../../lib/pipeline/expressions/AddExpression"),
 	AddExpression = require("../../../../lib/pipeline/expressions/AddExpression"),
 	ConstantExpression = require("../../../../lib/pipeline/expressions/ConstantExpression");
 	ConstantExpression = require("../../../../lib/pipeline/expressions/ConstantExpression");
 
 
+
 //TODO: refactor these test cases using Expression.parseOperand() or something because these could be a whole lot cleaner...
 //TODO: refactor these test cases using Expression.parseOperand() or something because these could be a whole lot cleaner...
 module.exports = {
 module.exports = {
 
 
@@ -130,4 +132,4 @@ module.exports = {
 
 
 };
 };
 
 
-if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
+if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);

+ 3 - 1
test/lib/pipeline/expressions/AndExpression.js

@@ -1,7 +1,9 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	AndExpression = require("../../../../lib/pipeline/expressions/AndExpression"),
 	AndExpression = require("../../../../lib/pipeline/expressions/AndExpression"),
 	Expression = require("../../../../lib/pipeline/expressions/Expression");
 	Expression = require("../../../../lib/pipeline/expressions/Expression");
 
 
+
 module.exports = {
 module.exports = {
 
 
 	"AndExpression": {
 	"AndExpression": {
@@ -136,4 +138,4 @@ module.exports = {
 
 
 };
 };
 
 
-if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
+if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);

+ 2 - 0
test/lib/pipeline/expressions/CoerceToBoolExpression.js

@@ -1,8 +1,10 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	CoerceToBoolExpression = require("../../../../lib/pipeline/expressions/CoerceToBoolExpression"),
 	CoerceToBoolExpression = require("../../../../lib/pipeline/expressions/CoerceToBoolExpression"),
 	FieldPathExpression = require("../../../../lib/pipeline/expressions/FieldPathExpression"),
 	FieldPathExpression = require("../../../../lib/pipeline/expressions/FieldPathExpression"),
 	ConstantExpression = require("../../../../lib/pipeline/expressions/ConstantExpression");
 	ConstantExpression = require("../../../../lib/pipeline/expressions/ConstantExpression");
 
 
+
 module.exports = {
 module.exports = {
 
 
 	"CoerceToBoolExpression": {
 	"CoerceToBoolExpression": {

+ 3 - 1
test/lib/pipeline/expressions/CompareExpression.js

@@ -1,8 +1,10 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	CompareExpression = require("../../../../lib/pipeline/expressions/CompareExpression"),
 	CompareExpression = require("../../../../lib/pipeline/expressions/CompareExpression"),
 	Expression = require("../../../../lib/pipeline/expressions/Expression"),
 	Expression = require("../../../../lib/pipeline/expressions/Expression"),
 	FieldRangeExpression = require("../../../../lib/pipeline/expressions/FieldRangeExpression");
 	FieldRangeExpression = require("../../../../lib/pipeline/expressions/FieldRangeExpression");
 
 
+
 module.exports = {
 module.exports = {
 
 
 	"CompareExpression": {
 	"CompareExpression": {
@@ -304,4 +306,4 @@ module.exports = {
 
 
 };
 };
 
 
-if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
+if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);

+ 2 - 0
test/lib/pipeline/expressions/CondExpression.js

@@ -1,7 +1,9 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	CondExpression = require("../../../../lib/pipeline/expressions/CondExpression"),
 	CondExpression = require("../../../../lib/pipeline/expressions/CondExpression"),
 	Expression = require("../../../../lib/pipeline/expressions/Expression");
 	Expression = require("../../../../lib/pipeline/expressions/Expression");
 
 
+
 module.exports = {
 module.exports = {
 
 
 	"CondExpression": {
 	"CondExpression": {

+ 3 - 1
test/lib/pipeline/expressions/ConstantExpression.js

@@ -1,6 +1,8 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	ConstantExpression = require("../../../../lib/pipeline/expressions/ConstantExpression");
 	ConstantExpression = require("../../../../lib/pipeline/expressions/ConstantExpression");
 
 
+
 module.exports = {
 module.exports = {
 
 
 	"ConstantExpression": {
 	"ConstantExpression": {
@@ -50,4 +52,4 @@ module.exports = {
 
 
 };
 };
 
 
-if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
+if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);

+ 3 - 1
test/lib/pipeline/expressions/DayOfMonthExpression.js

@@ -1,7 +1,9 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	DayOfMonthExpression = require("../../../../lib/pipeline/expressions/DayOfMonthExpression"),
 	DayOfMonthExpression = require("../../../../lib/pipeline/expressions/DayOfMonthExpression"),
 	Expression = require("../../../../lib/pipeline/expressions/Expression");
 	Expression = require("../../../../lib/pipeline/expressions/Expression");
 
 
+
 module.exports = {
 module.exports = {
 
 
 	"DayOfMonthExpression": {
 	"DayOfMonthExpression": {
@@ -44,4 +46,4 @@ module.exports = {
 
 
 };
 };
 
 
-if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
+if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);

+ 3 - 1
test/lib/pipeline/expressions/DayOfWeekExpression.js

@@ -1,7 +1,9 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	DayOfWeekExpression = require("../../../../lib/pipeline/expressions/DayOfWeekExpression"),
 	DayOfWeekExpression = require("../../../../lib/pipeline/expressions/DayOfWeekExpression"),
 	Expression = require("../../../../lib/pipeline/expressions/Expression");
 	Expression = require("../../../../lib/pipeline/expressions/Expression");
 
 
+
 module.exports = {
 module.exports = {
 
 
 	"DayOfWeekExpression": {
 	"DayOfWeekExpression": {
@@ -44,4 +46,4 @@ module.exports = {
 
 
 };
 };
 
 
-if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);
+if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);

+ 2 - 0
test/lib/pipeline/expressions/DayOfYearExpression.js

@@ -1,7 +1,9 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	DayOfYearExpression = require("../../../../lib/pipeline/expressions/DayOfYearExpression"),
 	DayOfYearExpression = require("../../../../lib/pipeline/expressions/DayOfYearExpression"),
 	Expression = require("../../../../lib/pipeline/expressions/Expression");
 	Expression = require("../../../../lib/pipeline/expressions/Expression");
 
 
+
 module.exports = {
 module.exports = {
 
 
 	"DayOfYearExpression": {
 	"DayOfYearExpression": {

+ 2 - 0
test/lib/pipeline/expressions/FieldPathExpression.js

@@ -1,6 +1,8 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	FieldPathExpression = require("../../../../lib/pipeline/expressions/FieldPathExpression");
 	FieldPathExpression = require("../../../../lib/pipeline/expressions/FieldPathExpression");
 
 
+
 module.exports = {
 module.exports = {
 
 
 	"FieldPathExpression": {
 	"FieldPathExpression": {

+ 2 - 0
test/lib/pipeline/expressions/FieldRangeExpression.js

@@ -1,7 +1,9 @@
+"use strict";
 var assert = require("assert"),
 var assert = require("assert"),
 	FieldPathExpression = require("../../../../lib/pipeline/expressions/FieldPathExpression"),
 	FieldPathExpression = require("../../../../lib/pipeline/expressions/FieldPathExpression"),
 	FieldRangeExpression = require("../../../../lib/pipeline/expressions/FieldRangeExpression");
 	FieldRangeExpression = require("../../../../lib/pipeline/expressions/FieldRangeExpression");
 
 
+
 module.exports = {
 module.exports = {
 
 
 	"FieldRangeExpression": {
 	"FieldRangeExpression": {

Some files were not shown because too many files changed in this diff