我正在使用node,nestjs和mongoose,我写了一个get调用并得到像
[
{
"_id": "5d4a9c0b1a6bcf14775c953c",
"material_name": "ramboo",
"material_status": 0,
"is_admin_approved": true,
"createdAt": "2019-08-07T09:38:19.237Z",
"updatedAt": "2019-08-07T09:38:19.237Z",
"id": "5d4a9c0b1a6bcf14775c953c"
}
]
这样的服务(material.service.ts)
async findAll(): Promise<IDMaterial[]> {
return await this.materialModel.find({is_admin_approved: true});
}
如何从结果中删除is_admin_approved字段,例如
[
{
"_id": "5d4a9c0b1a6bcf14775c953c",
"material_name": "ramboo",
"material_status": 0,
"createdAt": "2019-08-07T09:38:19.237Z",
"updatedAt": "2019-08-07T09:38:19.237Z",
"id": "5d4a9c0b1a6bcf14775c953c"
}
]
如何以任何方式解决此问题,请帮助我?
最佳答案
关于node.js - 在NestJS中更改JSON响应,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/57408088/