Skip to content

Commit

Permalink
fix aggregation match bug
Browse files Browse the repository at this point in the history
  • Loading branch information
baxiry committed Sep 12, 2024
1 parent 8e5c906 commit 71a87cd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions engine/aggregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ func aggrigate(query gjson.Result) string {
if err != nil {
return err.Error()
}
if len(data) == 0 {
return "[]"
}

group := query.Get("group")
if _id := group.Get("_id"); !_id.Exists() {
Expand Down
3 changes: 1 addition & 2 deletions engine/coreFuncs.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ func getData(query gjson.Result) (data []string, err error) {
}
defer rows.Close()

record := ""

isMatch := query.Get("match")

record := ""
for rows.Next() {

if limit == 0 {
Expand Down
3 changes: 3 additions & 0 deletions store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,7 @@ func (db *Database) Close() error {
}
clear(db.Collections)
return nil

}

// end

0 comments on commit 71a87cd

Please sign in to comment.