fix(mongodb): guard aggregate execution paths

This commit is contained in:
徐文彬 committed 2026-05-28 21:29:08 +08:00
1 parent c56bcb8e2d
commit 5ea146e08e
19 files changed
+166 -26

No files matched your search

+2 -1
View File
@@ -77,11 +77,12 @@ pub async fn mongo_aggregate_documents_core(
database: &str,
collection: &str,
pipeline_json: &str,
max_rows: Option<usize>,
) -> Result<MongoDocumentResult, String> {
let connections = state.connections.read().await;
match connections.get(connection_id).ok_or("Not found")? {
PoolKind::MongoDb(client) => {
mongo_driver::aggregate_documents(client, database, collection, pipeline_json).await
mongo_driver::aggregate_documents(client, database, collection, pipeline_json, max_rows).await
}
PoolKind::Agent(_) => Err("MongoDB legacy agent does not support aggregate".to_string()),
_ => Err("Not a MongoDB connection".to_string()),