diff options
author | fmonthel <fmonthel@flox-arts.net> | 2016-11-17 21:18:35 -0500 |
---|---|---|
committer | fmonthel <fmonthel@flox-arts.net> | 2016-11-17 21:18:35 -0500 |
commit | d11f069b6076de8b81d8228f76a8cf0012f8ffad (patch) | |
tree | 580f7c387d5ec299efd922d115c87cbdab533daf | |
parent | b90d668fbc28f931bf8cdf536311ed1bf2d7d2a7 (diff) | |
download | wekan-d11f069b6076de8b81d8228f76a8cf0012f8ffad.tar.gz wekan-d11f069b6076de8b81d8228f76a8cf0012f8ffad.tar.bz2 wekan-d11f069b6076de8b81d8228f76a8cf0012f8ffad.zip |
[ENH] Add index on CardId into Comments collection
-rw-r--r-- | models/cardComments.js | 6 |
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, |