feat(mongodb): support generic runCommand execution

This commit is contained in:
Guoyu Su authored and GitHub committed 2026-08-12 21:05:13 +08:00
1 parent 2d00620fac
commit 9b24d962bb
27 files changed
+580 -18

No files matched your search

+20
View File
@@ -4204,6 +4204,26 @@ export const useQueryStore = defineStore("query", () => {
});
break;
}
case "runCommand": {
if (options?.mongoSafety) {
const safety = evaluateMongoWriteSafety(mongoCommand, options.mongoSafety);
if (!safety.allowed) throw new Error(safety.reason);
}
queryExecutionLog("info", "mongo-run-command:start", {
traceId,
database: currentDatabase,
});
const result = await api.mongoRunCommand(executionConnectionId, currentDatabase, mongoCommand.commandJson, executionId);
allResults.push(markQueryResultRowsRaw(annotateMongoResult(mongoDocumentsToQueryResult(result.documents, performance.now() - commandStartedAt, result.total, result.extended_documents, result.total_is_exact !== false))));
mongoEditTarget = undefined;
queryExecutionLog("info", "mongo-run-command:done", {
traceId,
database: currentDatabase,
rowCount: result.documents.length,
elapsed: elapsed(),
});
break;
}
case "insert":
case "update":
case "delete":