
在传入非正常格式「objectid」的id的时候会报错。遂
async findById(id: string): Promise {
if (id.match(/^[0-9a-fA-F]{24}$/)) {
return await this.userModel.findById(id).exec()
} else {
return null;
}
}

在传入非正常格式「objectid」的id的时候会报错。遂
async findById(id: string): Promise {
if (id.match(/^[0-9a-fA-F]{24}$/)) {
return await this.userModel.findById(id).exec()
} else {
return null;
}
}