knex js, select is working but not delete
knex.js, node.js
Solution
Solved. I changed the where clause to an object instead.
/*
DELETE /api/project/products/:pr_id HTTP/1.1
*/
exports.deleteProduct = function(inputs, callback) {
var query = knex("products")
.del()
.where({
pr_id:inputs.params.pr_id
});
query.exec( function(err){
if(err) return callback(err);
sendResponse(callback);
})
}
Problem
Trying out the query builder knex.js, http://knexjs.org/ ``` exports.deleteProduct = function(inputs, callback) { //Working knex( "products" ).select().exec(function(err, resp) { console.log(resp) }); //Not working knex( "products" ).del().where( "pr_id", 349).exec(function(err, resp) { console.log(resp) });; } ``` The select statement works just fine. But not delete, also tried update. The response is 0. The record has not been deleted, have checked the db. I don't get any error if I run console.log(err) either. Any ideas?