From 5d05d6b0807cee5eaf1256ccad624c889ba985d6 Mon Sep 17 00:00:00 2001 From: TheFlow Date: Fri, 24 Oct 2025 10:25:02 +1300 Subject: [PATCH] fix(analytics): remove SessionSchema.index sessionId duplicate - Line 49 has sessionId with unique: true (creates index automatically) - Line 75 had redundant SessionSchema.index({ sessionId: 1 }) - Removed explicit index to eliminate Mongoose duplicate warning --- .claude/session-state.json | 16 ++++++++-------- src/models/Analytics.model.js | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.claude/session-state.json b/.claude/session-state.json index 29e6f43f..e8187ce2 100644 --- a/.claude/session-state.json +++ b/.claude/session-state.json @@ -43,7 +43,7 @@ "last_deliberation": null }, "FileEditHook": { - "timestamp": "2025-10-23T21:22:32.195Z", + "timestamp": "2025-10-23T21:24:52.570Z", "file": "/home/theflow/projects/tractatus/src/models/Analytics.model.js", "result": "passed" }, @@ -58,25 +58,25 @@ "tokens": 30000 }, "alerts": [], - "last_updated": "2025-10-23T21:22:32.196Z", + "last_updated": "2025-10-23T21:24:52.570Z", "initialized": true, "framework_components": { "CrossReferenceValidator": { "message": 0, "tokens": 0, - "timestamp": "2025-10-23T21:22:38.898Z", - "last_validation": "2025-10-23T21:22:38.898Z", - "validations_performed": 683 + "timestamp": "2025-10-23T21:24:59.638Z", + "last_validation": "2025-10-23T21:24:59.638Z", + "validations_performed": 694 }, "BashCommandValidator": { "message": 0, "tokens": 0, "timestamp": null, - "last_validation": "2025-10-23T21:22:38.899Z", - "validations_performed": 340, + "last_validation": "2025-10-23T21:24:59.639Z", + "validations_performed": 350, "blocks_issued": 37 } }, - "action_count": 340, + "action_count": 350, "auto_compact_events": [] } \ No newline at end of file diff --git a/src/models/Analytics.model.js b/src/models/Analytics.model.js index e420c02d..0284e0dd 100644 --- a/src/models/Analytics.model.js +++ b/src/models/Analytics.model.js @@ -72,7 +72,7 @@ const SessionSchema = new mongoose.Schema({ timestamps: true }); -SessionSchema.index({ sessionId: 1 }); +// sessionId already indexed via unique: true on line 49 SessionSchema.index({ visitorId: 1, startTime: -1 }); SessionSchema.index({ startTime: -1 });