summaryrefslogtreecommitdiffstats
path: root/models/cardComments.js
diff options
context:
space:
mode:
authorfmonthel <fmonthel@flox-arts.net>2016-11-17 21:18:35 -0500
committerfmonthel <fmonthel@flox-arts.net>2016-11-17 21:18:35 -0500
commitd11f069b6076de8b81d8228f76a8cf0012f8ffad (patch)
tree580f7c387d5ec299efd922d115c87cbdab533daf /models/cardComments.js
parentb90d668fbc28f931bf8cdf536311ed1bf2d7d2a7 (diff)
downloadwekan-d11f069b6076de8b81d8228f76a8cf0012f8ffad.tar.gz
wekan-d11f069b6076de8b81d8228f76a8cf0012f8ffad.tar.bz2
wekan-d11f069b6076de8b81d8228f76a8cf0012f8ffad.zip
[ENH] Add index on CardId into Comments collection
Diffstat (limited to 'models/cardComments.js')
-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..ccad14f7 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,