Преглед изворни кода

Refs #5125: Move sourceToJson to serialize

Chris Sexton пре 12 година
родитељ
комит
f9bbc69523

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

@@ -57,20 +57,6 @@ proto.getNext = function getNext(callback) {
 	return this.source.getNext();
 	return this.source.getNext();
 };
 };
 
 
-/**
- * Create an object that represents the document source.  The object
- * will have a single field whose name is the source's name.  This
- * will be used by the default implementation of addToJsonArray()
- * to add this object to a pipeline being represented in JSON.
- *
- * @method	sourceToJson
- * @param	{Object} builder	JSONObjBuilder: a blank object builder to write to
- * @param	{Boolean}	explain	create explain output
- **/
-proto.sourceToJson = function sourceToJson(builder, explain) {
-	builder.$limit = this.limit;
-};
-
 /**
 /**
  * Creates a new LimitDocumentSource with the input number as the limit
  * Creates a new LimitDocumentSource with the input number as the limit
  * @param {Number} JsonElement this thing is *called* Json, but it expects a number
  * @param {Number} JsonElement this thing is *called* Json, but it expects a number

+ 3 - 4
test/lib/pipeline/documentSources/LimitDocumentSource.js

@@ -101,14 +101,13 @@ module.exports = {
 
 
 		},
 		},
 
 
-		"#sourceToJson()": {
+		"#serialize()": {
 
 
 			"should create an object with a key $limit and the value equal to the limit": function sourceToJsonTest(){
 			"should create an object with a key $limit and the value equal to the limit": function sourceToJsonTest(){
 				var lds = new LimitDocumentSource();
 				var lds = new LimitDocumentSource();
 				lds.limit = 9;
 				lds.limit = 9;
-				var t = {};
-				lds.sourceToJson(t, false);
-				assert.deepEqual(t, { "$limit": 9 });
+				var actual = lds.serialize(false);
+				assert.deepEqual(actual, { "$limit": 9 });
 			}
 			}
 
 
 		},
 		},