mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: 优化record_main查询速度
This commit is contained in:
1 parent
36fa399518
commit
336432cc4f
3 files changed
+14
-3
No files matched your search
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable object-curly-newline */
|
||||
import {
|
||||
ObjectID, Collection, UpdateQuery,
|
||||
PushOperator, MatchKeysAndValues, OnlyFieldsOfType,
|
||||
@@ -232,5 +233,13 @@ bus.on('domain/delete', (domainId) => Promise.all([
|
||||
RecordModel.coll.updateMany({ pdomain: domainId }, { $set: { docId: -1 } }),
|
||||
]));
|
||||
|
||||
bus.on('app/started', () => {
|
||||
RecordModel.coll.createIndexes([
|
||||
{ key: { 'contest.tid': 1, hidden: 1, _id: -1 }, name: 'basic' },
|
||||
{ key: { 'contest.tid': 1, hidden: 1, uid: 1, _id: -1 }, name: 'withUser' },
|
||||
{ key: { 'contest.tid': 1, hidden: 1, pid: 1, _id: -1 }, name: 'withProblem' },
|
||||
]);
|
||||
});
|
||||
|
||||
export default RecordModel;
|
||||
global.Hydro.model.record = RecordModel;
|
||||
Reference in new issue
Block a user