Added support for new indexes

This commit is contained in:
Wyatt Johnson committed 2018-05-14 14:37:27 -06:00
1 parent 02b1e03c21
commit 8d44525c16
8 files changed
+118 -153

No files matched your search

+15 -3
View File
@@ -11,10 +11,22 @@ function getReactionConfig(reaction) {
if (CREATE_MONGO_INDEXES) {
// Create the index on the comment model based on the reaction config.
Comment.collection.createIndex(
Comment.collection.ensureIndex(
{
created_at: 1,
[`action_counts.${sc(reaction)}`]: 1,
asset_id: 1,
[`action_counts.${sc(reaction)}`]: -1,
created_at: -1,
},
{
background: true,
}
);
Comment.collection.ensureIndex(
{
asset_id: 1,
[`action_counts.${sc(reaction)}`]: -1,
created_at: -1,
},
{
background: true,