Skip to content

Commit bce3e1c

Browse files
committed
optimze mongodb query default limit=10
1 parent f6e9f46 commit bce3e1c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Plugins/BotSharp.Plugin.SqlDriver/Functions/SqlSelect.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,13 @@ private IFindFluent<BsonDocument, BsonDocument> ApplyChainedOperations(
154154
// Apply limit
155155
var limitMatch = Regex.Match(chainedOps, @"\.limit\s*\((\d+)\)");
156156
if (limitMatch.Success && int.TryParse(limitMatch.Groups[1].Value, out var limit))
157+
{
157158
findFluent = findFluent.Limit(limit);
159+
}
160+
else
161+
{
162+
findFluent = findFluent.Limit(10);
163+
}
158164

159165
return findFluent;
160166
}

0 commit comments

Comments
 (0)