I receive a naked JSON array for changes from the request body like
"event": {
"date": "2022-06-08",
"stime": "9:00 am",
"Status": "confirmed",
"id": "3a207381-0007-47b7-a4dd-bbbe44afcf18",
},
"changes": [
"date",
"time"
]
}
I want changes to be updated in the JSON column(update_change) in my table.
I am accessing changes in the request body with
var update_change = JSON.stringify(req.body.changes)
and passing to the Postgres query.
const query = `UPDATE events SET update_change =$1 WHERE id = $2`;
var values = [update_change,id];
Query receives update_changes is undefined.