diff --git a/packages/compass-saved-aggregations-queries/src/stores/delete-item.ts b/packages/compass-saved-aggregations-queries/src/stores/delete-item.ts index fcd507693c5..ba8e1b646de 100644 --- a/packages/compass-saved-aggregations-queries/src/stores/delete-item.ts +++ b/packages/compass-saved-aggregations-queries/src/stores/delete-item.ts @@ -55,10 +55,11 @@ export const confirmDeleteItem = ( undefined // this event is connection scoped when triggered from the aggregation or query screen ); - if (item.type === 'query') { - await queryStorage?.delete(item.id); - } else { + if (item.type === 'aggregation') { await pipelineStorage?.delete(item.id); + } else { + // query or updatemany + await queryStorage?.delete(item.id); } dispatch({ type: ActionTypes.DeleteItemConfirm, id: item.id }); diff --git a/packages/compass-saved-aggregations-queries/src/stores/edit-item.ts b/packages/compass-saved-aggregations-queries/src/stores/edit-item.ts index 76fa42d828a..a78c09fff6a 100644 --- a/packages/compass-saved-aggregations-queries/src/stores/edit-item.ts +++ b/packages/compass-saved-aggregations-queries/src/stores/edit-item.ts @@ -87,13 +87,14 @@ export const updateItem = return; } - if (item.type === 'query') { + if (item.type === 'aggregation') { + await pipelineStorage?.updateAttributes(id, attributes); + } else { + // query or updatemany await queryStorage?.updateAttributes(id, { _name: attributes.name, _dateModified: new Date(), }); - } else { - await pipelineStorage?.updateAttributes(id, attributes); } dispatch({ diff --git a/packages/compass-saved-aggregations-queries/src/stores/open-item.ts b/packages/compass-saved-aggregations-queries/src/stores/open-item.ts index 7cd6cbce17d..8a9589f4204 100644 --- a/packages/compass-saved-aggregations-queries/src/stores/open-item.ts +++ b/packages/compass-saved-aggregations-queries/src/stores/open-item.ts @@ -572,7 +572,8 @@ export const openSelectedItem = await pipelineStorage?.updateAttributes(id, { namespace: newNamespace, }); - } else if (selectedItem.type === 'query') { + } else { + // query or updatemany await queryStorage?.updateAttributes(id, { _ns: newNamespace }); } }