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
This commit is contained in:
TheFlow 2025-10-24 10:25:02 +13:00
parent ec5ace986d
commit 5d05d6b080
2 changed files with 9 additions and 9 deletions

View file

@ -43,7 +43,7 @@
"last_deliberation": null "last_deliberation": null
}, },
"FileEditHook": { "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", "file": "/home/theflow/projects/tractatus/src/models/Analytics.model.js",
"result": "passed" "result": "passed"
}, },
@ -58,25 +58,25 @@
"tokens": 30000 "tokens": 30000
}, },
"alerts": [], "alerts": [],
"last_updated": "2025-10-23T21:22:32.196Z", "last_updated": "2025-10-23T21:24:52.570Z",
"initialized": true, "initialized": true,
"framework_components": { "framework_components": {
"CrossReferenceValidator": { "CrossReferenceValidator": {
"message": 0, "message": 0,
"tokens": 0, "tokens": 0,
"timestamp": "2025-10-23T21:22:38.898Z", "timestamp": "2025-10-23T21:24:59.638Z",
"last_validation": "2025-10-23T21:22:38.898Z", "last_validation": "2025-10-23T21:24:59.638Z",
"validations_performed": 683 "validations_performed": 694
}, },
"BashCommandValidator": { "BashCommandValidator": {
"message": 0, "message": 0,
"tokens": 0, "tokens": 0,
"timestamp": null, "timestamp": null,
"last_validation": "2025-10-23T21:22:38.899Z", "last_validation": "2025-10-23T21:24:59.639Z",
"validations_performed": 340, "validations_performed": 350,
"blocks_issued": 37 "blocks_issued": 37
} }
}, },
"action_count": 340, "action_count": 350,
"auto_compact_events": [] "auto_compact_events": []
} }

View file

@ -72,7 +72,7 @@ const SessionSchema = new mongoose.Schema({
timestamps: true timestamps: true
}); });
SessionSchema.index({ sessionId: 1 }); // sessionId already indexed via unique: true on line 49
SessionSchema.index({ visitorId: 1, startTime: -1 }); SessionSchema.index({ visitorId: 1, startTime: -1 });
SessionSchema.index({ startTime: -1 }); SessionSchema.index({ startTime: -1 });