summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
Diffstat (limited to 'models')
-rw-r--r--models/cardComments.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/models/cardComments.js b/models/cardComments.js
index ce6edf3c..070c148e 100644
--- a/models/cardComments.js
+++ b/models/cardComments.js
@@ -57,6 +57,12 @@ CardComments.helpers({
CardComments.hookOptions.after.update = { fetchPrevious: false };
if (Meteor.isServer) {
+ // Comments are often fetched within a card, so we create an index to make these
+ // queries more efficient.
+ Meteor.startup(() => {
+ CardComments._collection._ensureIndex({ cardId: 1, createdAt: -1 });
+ });
+
CardComments.after.insert((userId, doc) => {
Activities.insert({
userId,