【发布时间】:2021-05-27 22:22:10
【问题描述】:
我有以下代码:
async setProcessedSubUser(id: ObjectId, processSub: ProcessSubscriptionInterface): Promise<???> {
return this.userModel.updateOne({ _id: id }, { inProcessSubscription: processSub });
}
执行查询时,响应类似于{ n: 1, nModified: 1, ok: 1 }
如果我这样调用我的函数:
return this.userService.setProcessedSubUser(YYY, XXX)
.then((response) => {
if (response.nModified !== 1) // error
return response;
})
代码崩溃是因为nModified dosen't exist on response。
我需要用什么类型代替????
【问题讨论】:
标签: typescript mongoose