From d108da8ef8b978e57b10e1092dc5cf316ae2de54 Mon Sep 17 00:00:00 2001 From: TheFlow Date: Fri, 24 Oct 2025 10:22:41 +1300 Subject: [PATCH] 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 --- src/models/Analytics.model.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/models/Analytics.model.js b/src/models/Analytics.model.js index 51c8519c..e420c02d 100644 --- a/src/models/Analytics.model.js +++ b/src/models/Analytics.model.js @@ -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 },