Skip to content

Commit

Permalink
mongo aggregate查询加limit行数限制,防止返回结果过多导致archery挂掉 (#1948)
Browse files Browse the repository at this point in the history
* mongo aggregate查询加limit行数限制,防止返回结果过多导致archery挂掉
  • Loading branch information
czxin788 authored Nov 4, 2022
1 parent 3ff5c95 commit 027904f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sql/engines/mongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,8 @@ def query(self, db_name=None, sql="", limit_num=0, close_conn=True, **kwargs):
if "condition" in query_dict:
if method == "aggregate":
condition = query_dict["condition"]
# 给aggregate查询加limit行数限制,防止返回结果过多导致archery挂掉
condition.append({"$limit": limit_num})
if method == "find":
condition = de.decode(query_dict["condition"])
find_cmd += "(condition)"
Expand Down

0 comments on commit 027904f

Please sign in to comment.