fix for Collection#group
This commit is contained in:
parent
bb13fbe687
commit
c49c208bff
|
@ -317,8 +317,9 @@ function () {
|
|||
var obj = c.next();
|
||||
|
||||
var key = {};
|
||||
for (var i in keys) {
|
||||
key[keys[i]] = obj[keys[i]];
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var k = keys[i];
|
||||
key[k] = obj[k];
|
||||
}
|
||||
|
||||
var aggObj = map.get(key);
|
||||
|
|
|
@ -607,6 +607,12 @@ class DBAPITest < Test::Unit::TestCase
|
|||
|
||||
assert_equal 3, test.group([], {}, {"count" => 0}, "function (obj, prev) { prev.count++; }")[0]["count"]
|
||||
assert_equal 1, test.group([], {"a" => {"$gt" => 1}}, {"count" => 0}, "function (obj, prev) { prev.count++; }")[0]["count"]
|
||||
|
||||
test.insert("a" => 2, "b" => 3)
|
||||
expected = [{"a" => 2, "count" => 2},
|
||||
{"a" => nil, "count" => 1},
|
||||
{"a" => 1, "count" => 1}]
|
||||
assert_equal expected, test.group(["a"], {}, {"count" => 0}, "function (obj, prev) { prev.count++; }")
|
||||
end
|
||||
|
||||
def test_deref
|
||||
|
|
Loading…
Reference in New Issue