Browse Source

EAGLESIX-2653: fix port to match current functionality/tests

Chris Sexton 11 years ago
parent
commit
0e2133308c
2 changed files with 20 additions and 23 deletions
  1. 1 4
      lib/pipeline/matcher/Matcher2.js
  2. 19 19
      test/lib/pipeline/matcher/Matcher2.js

+ 1 - 4
lib/pipeline/matcher/Matcher2.js

@@ -37,10 +37,7 @@ proto.matches = function matches(doc, details){
 	if (!this._expression)
 		return true;
 
-	if ((doc != {}) && (Object.keys(doc)[0]))
-		return this._expression.matchesJSON(doc, details);
-
-	return this._expression.matches(mydoc, details);
+	return this._expression.matchesJSON(doc, details);
 };
 
 /**

+ 19 - 19
test/lib/pipeline/matcher/Matcher2.js

@@ -1,4 +1,4 @@
-"use strict"
+"use strict";
 
 var assert = require("assert"),
 	MatchDetails = require("../../../../lib/pipeline/matcher/MatchDetails.js"),
@@ -64,23 +64,23 @@ module.exports = {
 
 		"WithinCenter - mongo Geo function, not porting": function() {},
 
-        "ElemMatchKey": function() {
-        	var query = {"a.b":1},
-        		m = new Matcher2(query),
-        		md = new MatchDetails();
-        	md.requestElemMatchKey();
-        	assert.ok(!md.hasElemMatchKey());
-        	assert.ok(m.matches({"a":[{"b":1}]}, md));
-        	assert.ok(md.hasElemMatchKey());
-        	assert.equal("0", md.elemMatchKey());
-        },
-
-        "WhereSimple1 - mongo MapReduce function, not available ": function() {
-        },
-
-        "AllTiming - mongo benchmarking function, not available": function() {
-        }
-	}
-}
+		"ElemMatchKey": function() {
+			var query = {"a.b":1},
+				m = new Matcher2(query),
+				md = new MatchDetails();
+			md.requestElemMatchKey();
+			assert.ok(!md.hasElemMatchKey());
+			assert.ok(m.matches({"a":[{"b":1}]}, md));
+			assert.ok(md.hasElemMatchKey());
+			assert.equal("0", md.elemMatchKey());
+		},
+
+		"WhereSimple1 - mongo MapReduce function, not available ": function() {
+		},
+
+		"AllTiming - mongo benchmarking function, not available": function() {
+		}
+		}
+};
 
 if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);