feat(诸子列传): 查询其他好友数据

This commit is contained in:
luying
2023-07-12 20:25:45 +08:00
parent 1eb6f76cce
commit b6cd9e6784
5 changed files with 17 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
import BaseModel from './BaseModel';
import { index, getModelForClass, prop, DocumentType, modelOptions } from '@typegoose/typegoose';
import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoose';
/**
* 诸子百家
@@ -28,8 +28,8 @@ export default class AuthorBook extends BaseModel {
@prop({ required: true, default: [], type: Author, _id: false })
authors: Author[];
public static async findByRoleId(roleId: string) {
let result: AuthorBookType[] = await AuthorBookModel.find({ roleId }).select('-_id -roleId').lean();
public static async findByRoleId(roleId: string, select = '-_id') {
let result: AuthorBookType[] = await AuthorBookModel.find({ roleId }).select(select).lean();
return result;
}