core: add limit to problem.getPrefixList

This commit is contained in:
undefined committed 2022-09-20 01:41:53 +08:00
1 parent ca670a2f12
commit 10dd5d28d5
5 files changed
+14 -10

No files matched your search

+2 -1
View File
@@ -340,7 +340,8 @@ export class ProblemModel {
prefix = prefix.toLowerCase();
const $regex = new RegExp(`\\A${escapeRegExp(prefix)}`, 'gmi');
const filter = { $or: [{ pid: { $regex } }, { title: { $regex } }] };
return await document.getMulti(domainId, document.TYPE_PROBLEM, filter, ['domainId', 'docId', 'pid', 'title']).toArray();
return await document.getMulti(domainId, document.TYPE_PROBLEM, filter, ['domainId', 'docId', 'pid', 'title'])
.limit(20).toArray();
}
static async getListStatus(domainId: string, uid: number, pids: number[]) {