fix(analytics): remove duplicate sessionId index in PageViewSchema

- PageViewSchema had 'index: true' on sessionId field (line 16)
- AND compound index PageViewSchema.index({ sessionId: 1, timestamp: -1 })
- Compound index already covers sessionId queries (leftmost prefix)
- Removed redundant single-field index to eliminate Mongoose warning
This commit is contained in:
TheFlow 2025-10-24 10:22:41 +13:00
parent 08a036be3d
commit ec5ace986d
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:21:14.842Z", "timestamp": "2025-10-23T21:22:32.195Z",
"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:21:14.842Z", "last_updated": "2025-10-23T21:22:32.196Z",
"initialized": true, "initialized": true,
"framework_components": { "framework_components": {
"CrossReferenceValidator": { "CrossReferenceValidator": {
"message": 0, "message": 0,
"tokens": 0, "tokens": 0,
"timestamp": "2025-10-23T21:21:26.151Z", "timestamp": "2025-10-23T21:22:38.898Z",
"last_validation": "2025-10-23T21:21:26.150Z", "last_validation": "2025-10-23T21:22:38.898Z",
"validations_performed": 679 "validations_performed": 683
}, },
"BashCommandValidator": { "BashCommandValidator": {
"message": 0, "message": 0,
"tokens": 0, "tokens": 0,
"timestamp": null, "timestamp": null,
"last_validation": "2025-10-23T21:21:26.152Z", "last_validation": "2025-10-23T21:22:38.899Z",
"validations_performed": 337, "validations_performed": 340,
"blocks_issued": 37 "blocks_issued": 37
} }
}, },
"action_count": 337, "action_count": 340,
"auto_compact_events": [] "auto_compact_events": []
} }

View file

@ -13,7 +13,7 @@ const PageViewSchema = new mongoose.Schema({
// Visitor Information (privacy-respecting) // Visitor Information (privacy-respecting)
visitorId: { type: String, required: true, index: true }, // Hashed IP + User Agent visitorId: { type: String, required: true, index: true }, // Hashed IP + User Agent
sessionId: { type: String, required: true, index: true }, // Session identifier sessionId: { type: String, required: true }, // Session identifier (indexed via compound index below)
// Request Details // Request Details
userAgent: { type: String }, userAgent: { type: String },