From 3790bdcff2ea04785a461949c1c6d2902518c3dd Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Fri, 26 Jun 2026 12:18:12 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=87=20fix:=20Index=20sharedlinks=20upd?= =?UTF-8?q?atedAt=20for=20Cosmos=20DB=20Sorts=20(#13979)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The getSharedLink query sorts by updatedAt, but the sharedlinks collection had no updatedAt index. Azure Cosmos DB for MongoDB (RU-based) rejects sorts on non-indexed fields, causing an immediate 500 on GET /api/share/link/:conversationId whenever a conversation is opened. Standard MongoDB is unaffected. --- packages/data-schemas/src/schema/share.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/data-schemas/src/schema/share.ts b/packages/data-schemas/src/schema/share.ts index ca09857365..42bfca6ea8 100644 --- a/packages/data-schemas/src/schema/share.ts +++ b/packages/data-schemas/src/schema/share.ts @@ -84,5 +84,6 @@ const shareSchema: Schema = new Schema( shareSchema.index({ expiredAt: 1 }, { expireAfterSeconds: 0 }); shareSchema.index({ conversationId: 1, user: 1, targetMessageId: 1, tenantId: 1 }); +shareSchema.index({ updatedAt: -1 }); export default shareSchema;