Prechádzať zdrojové kódy

EAGLESIX-2653: s/matchesBSON/matchesJSON/g

Chris Sexton 11 rokov pred
rodič
commit
757f7b96f2

+ 1 - 1
lib/pipeline/matcher/MatchExpression.js

@@ -158,7 +158,7 @@ proto.matches = function matches(doc, details/* = 0 */) {
 
 /**
  * Wrapper around matches function
- * @method matchesBSON
+ * @method matchesJSON
  */
 proto.matchesJSON = function matchesJSON(doc, details/* = 0 */){
 	return this.matches(doc, details);

+ 2 - 2
lib/pipeline/matcher/Matcher2.js

@@ -265,10 +265,10 @@ proto.matches = function matches(doc, details){
 		return true;
 
 	if (this._indexKey == {})
-		return this._expression.matchesBSON(doc, details);
+		return this._expression.matchesJSON(doc, details);
 
 	if ((doc != {}) && (Object.keys(doc)[0]))
-		return this._expression.matchesBSON(doc, details);
+		return this._expression.matchesJSON(doc, details);
 
 	var mydoc = new IndexKeyMatchableDocument(this._indexKey, doc);
 	return this._expression.matches(mydoc, details);

+ 8 - 8
test/lib/pipeline/matcher/AndMatchExpression.js

@@ -60,11 +60,11 @@ module.exports = {
 			andOp.add(sub2);
 			andOp.add(sub3);
 
-			assert.ok(andOp.matchesBSON({"a":5, "b":6}, null));
-			assert.ok(!andOp.matchesBSON({"a":5}, null));
-			assert.ok(!andOp.matchesBSON({"b":6}, null ));
-			assert.ok(!andOp.matchesBSON({"a":1, "b":6}, null));
-			assert.ok(!andOp.matchesBSON({"a":10, "b":6}, null));
+			assert.ok(andOp.matchesJSON({"a":5, "b":6}, null));
+			assert.ok(!andOp.matchesJSON({"a":5}, null));
+			assert.ok(!andOp.matchesJSON({"b":6}, null ));
+			assert.ok(!andOp.matchesJSON({"a":1, "b":6}, null));
+			assert.ok(!andOp.matchesJSON({"a":10, "b":6}, null));
 		},
 		"Should have an elemMatchKey": function(){
 			var baseOperand1 = {"a":1},
@@ -81,11 +81,11 @@ module.exports = {
 			andOp.add(sub2);
 
 			details.requestElemMatchKey();
-			assert.ok(!andOp.matchesBSON({"a":[1]}, details));
+			assert.ok(!andOp.matchesJSON({"a":[1]}, details));
 			assert.ok(!details.hasElemMatchKey());
-			assert.ok(!andOp.matchesBSON({"b":[2]}, details));
+			assert.ok(!andOp.matchesJSON({"b":[2]}, details));
 			assert.ok(!details.hasElemMatchKey());
-			assert.ok(andOp.matchesBSON({"a":[1], "b":[1, 2]}, details));
+			assert.ok(andOp.matchesJSON({"a":[1], "b":[1, 2]}, details));
 			assert.ok(details.hasElemMatchKey());
 			// The elem match key for the second $and clause is recorded.
 			assert.strictEqual("1", details.elemMatchKey());

+ 4 - 4
test/lib/pipeline/matcher/NorMatchExpression.js

@@ -84,13 +84,13 @@ module.exports = {
 			orOp.add(sub2);
 
 			details.requestElemMatchKey();
-			assert.ok( orOp.matchesBSON({"a":[10], 'b':[10]}, details));
+			assert.ok( orOp.matchesJSON({"a":[10], 'b':[10]}, details));
 			assert.ok(!details.hasElemMatchKey());
 
-			assert.ok( ! orOp.matchesBSON({"a":[1], "b":[1, 2]}, details));
+			assert.ok( ! orOp.matchesJSON({"a":[1], "b":[1, 2]}, details));
 			assert.ok(!details.hasElemMatchKey());
-		
-			
+
+
 		}
 
 

+ 4 - 4
test/lib/pipeline/matcher/OrMatchExpression.js

@@ -84,13 +84,13 @@ module.exports = {
 			orOp.add(sub2);
 
 			details.requestElemMatchKey();
-			assert.ok(!orOp.matchesBSON({"a":[10], 'b':[10]}, details));
+			assert.ok(!orOp.matchesJSON({"a":[10], 'b':[10]}, details));
 			assert.ok(!details.hasElemMatchKey());
 
-			assert.ok(orOp.matchesBSON({"a":[1], "b":[1, 2]}, details));
+			assert.ok(orOp.matchesJSON({"a":[1], "b":[1, 2]}, details));
 			assert.ok(!details.hasElemMatchKey());
-		
-			
+
+
 		}