I'm creating a post request which inserts multiple values into my table, but I'm getting a 'column count doesn't match value count at row 1' error
I know this error is triggered when the number of values you provide in a query doesn't match the number of columns. However, I can't find the source of my issue. My query roughly looks like this:
db.connection('INSERT into Surveys (name, location, options) VALUES (?,?,?)', [req.name, req.location, req.options], .....
One of my SQL columns (named 'options') is a JSON column. My app's front end will provide the data like this: {choices: ["Option 1","Option 2","Option 3","Option 4"]}.
If this options value is null, the query works perfectly. However, if the options value is in the JSON format depicted above, the error is triggered. Note: I'm able to manually enter the JSON using mySQL Workbench with no issues.
Any theories on what could be going on?