i want to modify my hook.data object in my node application after insertion of data. actually i'm not able to.
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()
})
}]
result: still _id is exist
{
"_id": "59ca334e7bc4e06b140aadf9",
"algorithm": [
{
"name": "SA"
}
]
}
i update object using the hook.result in following way and hook.result will have its Mongoose documents converted to plain objects. more information reference link
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()
})
}]
result: It was removed from response
{
"algorithm": [
{
"name": "SA"
}
]
}