1 parent
462f8e1fb2
commit
65792128e4
7 files changed
+515
-1
No files matched your search
@@ -15,6 +15,7 @@ import {
|
||||
evaluateMongoWriteSafety,
|
||||
mongoCollectionStatsToQueryResult,
|
||||
mongoCountToQueryResult,
|
||||
mongoDatabasesToQueryResult,
|
||||
mongoDistinctToQueryResult,
|
||||
mongoCreateIndexToQueryResult,
|
||||
mongoDocumentsToQueryResult,
|
||||
@@ -4092,6 +4093,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
queryExecutionLog("info", "mongo:start", { traceId, commandCount: mongoCommands.length, sqlLength: sql.length });
|
||||
|
||||
const allResults: QueryResult[] = [];
|
||||
const mongoResultMaxRows = effectiveQueryResultMaxRows(settingsStore.editorSettings.queryResultMaxRowsEnabled, settingsStore.editorSettings.queryResultMaxRows);
|
||||
// Track the effective db as we walk the batch so later commands observe
|
||||
// earlier `use ...` statements in the same editor selection.
|
||||
let currentDatabase = executionTarget?.database ?? tab.database;
|
||||
@@ -4175,6 +4177,19 @@ export const useQueryStore = defineStore("query", () => {
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "showDatabases": {
|
||||
queryExecutionLog("info", "mongo-show-databases:start", { traceId });
|
||||
const result = await api.mongoRunCommand(executionConnectionId, "admin", '{"listDatabases":1}', executionId);
|
||||
const queryResult = mongoDatabasesToQueryResult(result.documents, performance.now() - commandStartedAt, agentProtocolQueryResultMaxRows(mongoResultMaxRows));
|
||||
allResults.push(markQueryResultRowsRaw(annotateMongoResult(queryResult)));
|
||||
mongoEditTarget = undefined;
|
||||
queryExecutionLog("info", "mongo-show-databases:done", {
|
||||
traceId,
|
||||
databaseCount: queryResult.affected_rows,
|
||||
elapsed: elapsed(),
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "countDocuments": {
|
||||
queryExecutionLog("info", "mongo-count:start", { traceId, collection: mongoCommand.collection, database: currentDatabase });
|
||||
const total = await api.mongoCountDocuments(executionConnectionId, currentDatabase, mongoCommand.collection, mongoCommand.filter, mongoCommand.mode, executionId);
|
||||
|
||||
Reference in new issue
Block a user