I am trying to use angular $http.post method to send an updated object to a node.js backend that uses mongoose.
I have a use-case that a user can make a field undefined, which is ok and should eventually make the mongoose to unset that field from the mongo document.
The problem is that angular.js $http.post actually just does not send any fields that their value is undefined.
This is my line for example:
return $http.post(`/api/update`, {
field1: 1,
field2: 'hey',
field3: undefined
});
If i then take a look using the developer tools, i will see that the sent object only contains the 2 first fields.
What should i do to make $http send also fields that are undefined?
via lobengula3rd
No comments:
Post a Comment