feat(mongo): improve completion and add distinct support
This commit is contained in:
1 parent
5bcad3adc6
commit
640e82cdc6
19 files changed
+1865
-275
No files matched your search
@@ -14,6 +14,7 @@ import {
|
||||
evaluateMongoWriteSafety,
|
||||
mongoCollectionStatsToQueryResult,
|
||||
mongoCountToQueryResult,
|
||||
mongoDistinctToQueryResult,
|
||||
mongoCreateIndexToQueryResult,
|
||||
mongoDocumentsToQueryResult,
|
||||
mongoDroppedIndexesToQueryResult,
|
||||
@@ -2984,6 +2985,21 @@ export const useQueryStore = defineStore("query", () => {
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "distinct": {
|
||||
queryExecutionLog("info", "mongo-distinct:start", { traceId, collection: mongoCommand.collection, database: currentDatabase, field: mongoCommand.field });
|
||||
const result = await api.mongoDistinct(tab.connectionId, currentDatabase, mongoCommand.collection, mongoCommand.field, mongoCommand.filter, executionId);
|
||||
allResults.push(markQueryResultRowsRaw(annotateMongoResult(mongoDistinctToQueryResult(mongoCommand.field, result.documents, performance.now() - commandStartedAt))));
|
||||
mongoEditTarget = undefined;
|
||||
queryExecutionLog("info", "mongo-distinct:done", {
|
||||
traceId,
|
||||
collection: mongoCommand.collection,
|
||||
database: currentDatabase,
|
||||
field: mongoCommand.field,
|
||||
valueCount: result.documents.length,
|
||||
elapsed: elapsed(),
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "getIndexes": {
|
||||
queryExecutionLog("info", "mongo-indexes:start", { traceId, collection: mongoCommand.collection, database: currentDatabase });
|
||||
const indexes = await api.listIndexes(tab.connectionId, currentDatabase, "", mongoCommand.collection);
|
||||
|
||||
Reference in new issue
Block a user