Skip to content

Commit 71a87cd

Browse files
committed
fix aggregation match bug
1 parent 8e5c906 commit 71a87cd

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

engine/aggregate.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ func aggrigate(query gjson.Result) string {
8181
if err != nil {
8282
return err.Error()
8383
}
84+
if len(data) == 0 {
85+
return "[]"
86+
}
8487

8588
group := query.Get("group")
8689
if _id := group.Get("_id"); !_id.Exists() {

engine/coreFuncs.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,9 @@ func getData(query gjson.Result) (data []string, err error) {
3535
}
3636
defer rows.Close()
3737

38-
record := ""
39-
4038
isMatch := query.Get("match")
4139

40+
record := ""
4241
for rows.Next() {
4342

4443
if limit == 0 {

store/store.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,4 +166,7 @@ func (db *Database) Close() error {
166166
}
167167
clear(db.Collections)
168168
return nil
169+
169170
}
171+
172+
// end

0 commit comments

Comments
 (0)