mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
core: optimize query speed
This commit is contained in:
1 parent
f5c63e02ce
commit
f1e2409991
20 files changed
+116
-147
No files matched your search
@@ -14,8 +14,8 @@ import TaskModel from '../model/task';
|
||||
import user from '../model/user';
|
||||
import * as bus from '../service/bus';
|
||||
import {
|
||||
Connection, ConnectionHandler, Handler, param,
|
||||
Route, Types } from '../service/server';
|
||||
Connection, ConnectionHandler, Handler, param, Route, Types,
|
||||
} from '../service/server';
|
||||
import { buildProjection } from '../utils';
|
||||
import { postJudge } from './judge';
|
||||
|
||||
@@ -57,9 +57,8 @@ class RecordListHandler extends Handler {
|
||||
if (status) q.status = status;
|
||||
if (all) {
|
||||
this.checkPriv(PRIV.PRIV_MANAGE_ALL_DOMAIN);
|
||||
q.domainId = { $exists: true };
|
||||
}
|
||||
let cursor = record.getMulti(domainId, q).sort('_id', -1);
|
||||
let cursor = record.getMulti(all ? '' : domainId, q).sort('_id', -1);
|
||||
if (!full) cursor = cursor.project(buildProjection(record.PROJECTION_LIST));
|
||||
const limit = full ? 10 : system.get('pagination.record');
|
||||
const rdocs = invalid
|
||||
|
||||
Reference in new issue
Block a user