From 1c1f2be497cd9f77f26254f5f445aee1b7f2b33a Mon Sep 17 00:00:00 2001 From: Matt Lott <mattlott@live.com> Date: Tue, 6 Jan 2015 14:54:56 -0800 Subject: [PATCH] Changing analytics.log.event indexes to compound Changing this back. Using mongodb hint() and explain() on our find() call indicates the compound index is better than the two single indexes. --- server/analytics/AnalyticsLogEvent.coffee | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/server/analytics/AnalyticsLogEvent.coffee b/server/analytics/AnalyticsLogEvent.coffee index 771a195c3..1f82c2780 100644 --- a/server/analytics/AnalyticsLogEvent.coffee +++ b/server/analytics/AnalyticsLogEvent.coffee @@ -6,7 +6,6 @@ AnalyticsLogEventSchema = new mongoose.Schema({ type: Date 'default': Date.now }, {strict: false}) -AnalyticsLogEventSchema.index event: 1 -AnalyticsLogEventSchema.index created: -1 +AnalyticsLogEventSchema.index({event: 1, created: -1}) module.exports = AnalyticsLogEvent = mongoose.model('analytics.log.event', AnalyticsLogEventSchema)