LoopBack PUT (Update By ID) operation

190 views
Skip to first unread message

Bhavna Gyanchandani

unread,
Aug 16, 2016, 2:40:17 AM8/16/16
to LoopbackJS
In PUT (Update By Id) Operation,The response on LoopBack App is not as expected.
Lets say, In my model, I have 10 fields out of which I want to update 3 fields.
When we pass the value for three fields in Put operation, in the response we get these three updated values in the fields along with  all the  other 7  fields, which were not part of the request.
Looks like, the framework calls 'GET By ID' before  'UPDATE by ID'.
Is this the expected behavior or am I missing on something.
Please provide any information, if available on this.



Rémi Flipo

unread,
Aug 16, 2016, 8:19:50 AM8/16/16
to LoopbackJS
Hello,
this is indeed the expected behavior, you'll get the entire object back on a PUT request.

If you need to remove/change fields on the response, consider using remote hooks (https://docs.strongloop.com/display/public/LB/Remote+hooks)
Reply all
Reply to author
Forward
0 new messages