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
},
"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",
"result": "passed"
},
@ -58,25 +58,25 @@
"tokens": 30000
},
"alerts": [],
"last_updated": "2025-10-23T21:21:14.842Z",
"last_updated": "2025-10-23T21:22:32.196Z",
"initialized": true,
"framework_components": {
"CrossReferenceValidator": {
"message": 0,
"tokens": 0,
"timestamp": "2025-10-23T21:21:26.151Z",
"last_validation": "2025-10-23T21:21:26.150Z",
"validations_performed": 679
"timestamp": "2025-10-23T21:22:38.898Z",
"last_validation": "2025-10-23T21:22:38.898Z",
"validations_performed": 683
},
"BashCommandValidator": {
"message": 0,
"tokens": 0,
"timestamp": null,
"last_validation": "2025-10-23T21:21:26.152Z",
"validations_performed": 337,
"last_validation": "2025-10-23T21:22:38.899Z",
"validations_performed": 340,
"blocks_issued": 37
}
},
"action_count": 337,
"action_count": 340,
"auto_compact_events": []
}

View file

@ -13,7 +13,7 @@ const PageViewSchema = new mongoose.Schema({
// Visitor Information (privacy-respecting)
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
userAgent: { type: String },