Browse Source

Merge pull request #111 from RiveraGroup/feature/mongo_2.6.5_documentSource_Out

Feature/mongo 2.6.5 document source out
Chris Sexton 11 years ago
parent
commit
c0f3667299

+ 8 - 2
lib/pipeline/documentSources/OutDocumentSource.js

@@ -10,13 +10,13 @@ var DocumentSource = require('./DocumentSource');
  * @param [ctx] {ExpressionContext}
  **/
 var OutDocumentSource = module.exports = function OutDocumentSource(outputNs, ctx){
-	if (arguments.length > 2) throw new Error("up to two arg expected");
+	if (arguments.length > 2) throw new Error("up to two args expected");
 	base.call(this, ctx);
 	// defaults
 	this._done = false;
 	this._outputNs = outputNs;
 	this._collectionName = "";
-}, klass = OutDocumentSource, base = require('./DocumentSource'), proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
+}, klass = OutDocumentSource, base = DocumentSource, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
 
 klass.outName = "$out";
 
@@ -47,6 +47,12 @@ klass.createFromJson = function(jsonElement, ctx) {
 	return out;
 };
 
+// SplittableDocumentSource implementation.
+klass.isSplittableDocumentSource = true;
+
+//NeedsMongodDocumentSource implementation
+klass.needsMongodDocumentSource = true;
+
 proto.getDependencies = function(deps) {
 	deps.needWholeDocument = true;
 	return DocumentSource.GetDepsReturn.EXHAUSTIVE;

+ 1 - 1
test/lib/pipeline/documentSources/OutDocumentSource.js

@@ -41,7 +41,7 @@ module.exports = {
 				assert.throws(ods.getNext.bind(ods));
 			},
 
-			"should act ass passthrough (for now)": function(next) {
+			"should act as passthrough (for now)": function(next) {
 				var ods = OutDocumentSource.createFromJson("test"),
 					cwc = new CursorDocumentSource.CursorWithContext(),
 					l = [{_id:0,a:[{b:1},{b:2}]}, {_id:1,a:[{b:1},{b:1}]} ];