summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2016-11-20 23:12:07 +0200
committerGitHub <noreply@github.com>2016-11-20 23:12:07 +0200
commit693f615136319e0e6da370294270272691713f94 (patch)
treecec046d3f6dfcb7ae8da2c585215c63c3df8893f
parent532a3bbb49e0257aa3cea1183687452b4dc28f14 (diff)
parent584ab26aee7e242913ea3f9d901fec0c950225f0 (diff)
downloadwekan-693f615136319e0e6da370294270272691713f94.tar.gz
wekan-693f615136319e0e6da370294270272691713f94.tar.bz2
wekan-693f615136319e0e6da370294270272691713f94.zip
Merge pull request #18 from fmonthel/devel
[ENH] Add index on CardId into Comments collection
-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,