opt(mongo): optimization db index

This commit is contained in:
OldHawk
2017-12-23 17:26:39 +08:00
parent 56d6a4b67a
commit bae7da82c0
14 changed files with 68 additions and 19 deletions

View File

@@ -146,6 +146,8 @@ var TopicSchema = new Schema({
}
}, {usePushEach: true});
TopicSchema.index({forum: 1, isTop: -1, lastReplyAt: -1, createdAt: -1});
TopicSchema.index({isGlobal: 1, forum: -1});
mongoose.model('Topic', TopicSchema);
mongoose.model('Attach', AttachSchema);