透過 resetful api 的 ajax 傳回來的 json object 無法寫入值, 替代解法很多, 有人是轉成object, 建議可以這樣做:
let tmpObj = JSON.parse(JSON.stringify(myApiVar));
Try to .toObject()
the form:
https://stackoverflow.com/questions/30879898/unable-to-add-property-to-the-json-object
Form.findOneAndUpdate(condition, req.body, {upsert:true}, function(err, form){
if (err) return res.send(500, { error: err });
var objForm = form.toObject();
objForm.status = "saved successfully";
return res.send(objForm);
});