📇 fix: Index sharedlinks updatedAt for Cosmos DB Sorts (#13979)

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.
This commit is contained in:
Danny Avila 2026-06-26 12:18:12 -04:00 committed by GitHub
parent edeb1ecc2c
commit 3790bdcff2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -84,5 +84,6 @@ const shareSchema: Schema<ISharedLink> = 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;