NestJS在返回Mongoose文档时过滤掉空属性
我在mongoose文档中有一个嵌套很深的对象,其中包含以下数据:NestJS在返回Mongoose文档时过滤掉空属性,mongoose,nestjs,Mongoose,Nestjs,我在mongoose文档中有一个嵌套很深的对象,其中包含以下数据: { blocks: [ { key: '3a673', text: 'kjhkhj', type: 'unstyled', depth: 0, inlineStyleRanges: [], entityRanges: [], data: {} } ], entityMap: {} } 当我从数据库和console.
{
blocks: [
{
key: '3a673',
text: 'kjhkhj',
type: 'unstyled',
depth: 0,
inlineStyleRanges: [],
entityRanges: [],
data: {}
}
],
entityMap: {}
}
当我从数据库和console.log中检索它时,这就是我得到的结果。
但当我将文档作为响应返回时,空对象将被过滤掉,我只得到:
{
blocks: [
{
key: '3a673',
text: 'kjhkhj',
type: 'unstyled',
depth: 0,
inlineStyleRanges: [],
entityRanges: [],
}
],
}
我该如何解决这个问题