fix(mongodb): guard aggregate execution paths
This commit is contained in:
1 parent
c56bcb8e2d
commit
5ea146e08e
19 files changed
+166
-26
No files matched your search
@@ -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()),
|
||||
|
||||
Reference in new issue
Block a user