Browse Source

Refs #2063: Allow Pipeline class to be overridden.

Charles Ezell 13 years ago
parent
commit
f7d5d33cce
1 changed files with 5 additions and 4 deletions
  1. 5 4
      lib/commands/PipelineCommand.js

+ 5 - 4
lib/commands/PipelineCommand.js

@@ -13,11 +13,12 @@ var PipelineCommand = module.exports = (function(){
         /* 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, 
         //but we decided it would be better to be able to save the parsed command
-        this.pPipeline = Pipeline.parseCommand(cmdObj);
+        this.pPipeline = klass.Pipeline.parseCommand(cmdObj);
 	}, base = Object, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
 
-	var Pipeline = require('../pipeline/Pipeline'),
-		PipelineD = require('../pipeline/PipelineD');
+    //Put these on the class so they can be overriden.
+	klass.Pipeline = require('../pipeline/Pipeline');
+	klass.PipelineD = require('../pipeline/PipelineD');
 
 	/**
 	 * Execute the pipeline.
@@ -32,7 +33,7 @@ var PipelineCommand = module.exports = (function(){
 	 * @method runExecute
 	 **/
 	proto.runExecute = function runExecute(db, callback){
-		var pSource = PipelineD.prepareCursorSource(this.pPipeline, db);
+		var pSource = klass.PipelineD.prepareCursorSource(this.pPipeline, db);
         return this.executePipeline(this.pPipeline, pSource, callback);
 	};