diff options
author | Maxime Quandalle <mquandalle@wekan.io> | 2016-07-18 22:38:38 +0200 |
---|---|---|
committer | Maxime Quandalle <mquandalle@wekan.io> | 2016-07-18 22:38:38 +0200 |
commit | 9792193e605a8df8989c36e1e4edad25464aa442 (patch) | |
tree | 248750df6e619afc20c4fdc848da63a3d3c526a3 /models/cards.js | |
parent | 81a35be8562cb6c28848afc2cb24ae9ec145ce47 (diff) | |
download | wekan-9792193e605a8df8989c36e1e4edad25464aa442.tar.gz wekan-9792193e605a8df8989c36e1e4edad25464aa442.tar.bz2 wekan-9792193e605a8df8989c36e1e4edad25464aa442.zip |
Add MongoDB indexes
These indexes will optimize the queries that are used in the board and card
views.
Fixes #524.
Diffstat (limited to 'models/cards.js')
-rw-r--r-- | models/cards.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/models/cards.js b/models/cards.js index aa19a64a..84fbb6c2 100644 --- a/models/cards.js +++ b/models/cards.js @@ -210,6 +210,12 @@ Cards.mutations({ }); if (Meteor.isServer) { + // Cards are often fetched within a board, so we create an index to make these + // queries more efficient. + Meteor.startup(() => { + Cards._collection._ensureIndex({ boardId: 1 }); + }); + Cards.after.insert((userId, doc) => { Activities.insert({ userId, |