Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

给aggregate查询加limit行数限制,防止返回结果过多导致archery挂掉 #1948

Merged
merged 3 commits into from
Nov 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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