From d11f069b6076de8b81d8228f76a8cf0012f8ffad Mon Sep 17 00:00:00 2001 From: fmonthel Date: Thu, 17 Nov 2016 21:18:35 -0500 Subject: [ENH] Add index on CardId into Comments collection --- models/cardComments.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'models') 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, -- cgit v1.2.3-1-g7c22 From f71d2538fa15c9d8eb915d7b4dd9eb6a337d203d Mon Sep 17 00:00:00 2001 From: fmonthel Date: Thu, 17 Nov 2016 21:23:39 -0500 Subject: [ENH] Add index on CardId into Comments collection --- models/cardComments.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'models') diff --git a/models/cardComments.js b/models/cardComments.js index ccad14f7..2cadb65e 100644 --- a/models/cardComments.js +++ b/models/cardComments.js @@ -57,10 +57,10 @@ 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 }); + // 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) => { -- cgit v1.2.3-1-g7c22 From 584ab26aee7e242913ea3f9d901fec0c950225f0 Mon Sep 17 00:00:00 2001 From: fmonthel Date: Thu, 17 Nov 2016 21:25:49 -0500 Subject: [ENH] Add index on CardId into Comments collection --- models/cardComments.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'models') diff --git a/models/cardComments.js b/models/cardComments.js index 2cadb65e..070c148e 100644 --- a/models/cardComments.js +++ b/models/cardComments.js @@ -62,7 +62,7 @@ if (Meteor.isServer) { Meteor.startup(() => { CardComments._collection._ensureIndex({ cardId: 1, createdAt: -1 }); }); - + CardComments.after.insert((userId, doc) => { Activities.insert({ userId, -- cgit v1.2.3-1-g7c22