Skip to content
This repository was archived by the owner on Nov 5, 2024. It is now read-only.

Commit 34c7c0d

Browse files
committed
[mongo]优化MongoDB的全局的group性能(只统计前10万个数据),以避免查询超时
1 parent 02d5115 commit 34c7c0d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

teadb/driver_mongo.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,9 @@ func (this *MongoDriver) Group(query *Query, field string, result map[string]Exp
388388
map[string]interface{}{
389389
"$match": filter,
390390
},
391+
map[string]interface{}{
392+
"$limit": 100000, // 限制进入下一个pipeline的记录数量,以避免查询超时
393+
},
391394
map[string]interface{}{
392395
"$group": group,
393396
},

0 commit comments

Comments
 (0)