使用feathersjs创build后无法从对象中删除_id字段

我想在插入数据后在我的节点应用程序中修改我的hook.data对象。 其实我不能。

create: [function(hook, next) { delete hook.data._id; hook.data = { problem: hook.data } postJson(hook.app.get('jsprintUrl'), hook.data) .then(data =>{ hook.result = data; next() }) }] 

结果:仍然存在_id

 { "_id": "59ca334e7bc4e06b140aadf9", "algorithm": [ { "name": "SA" } ] } 

我用下面的方法使用hook.result更新对象,hook.result将其Mongoose文档转换为普通对象。 更多信息参考链接

 create: [function(hook, next) { delete hook.result._id; hook.result = { problem: hook.result } postJson(hook.app.get('jsprintUrl'), hook.result) .then(data =>{ hook.result = data; next() }) }] 

结果:它被从响应中删除

 { "algorithm": [ { "name": "SA" } ] }