bookshelf: How to prevent to throw "No rows were affected in the update"?
Hi, i’m trying to execute the follow update:
update `user_activity` set `parameters` = ?, `place_id` = ? where `place_id` = ?
So i write:
return UserActivity.where({place_id: place.id}).save({place_id: null, parameters: JSON.stringify({place_name: this.place.get('name')})}, {method: 'update', patch: true, transacting: transaction});
The update is correct but i’m getting the follow error:
Error: No rows were affected in the update, did you mean to pass the {method: "insert"} option?
How to prevent this behavior? I try “require”: false but is not working.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 15 (6 by maintainers)
@sandro-csimas where did you try adding
require: false?Here is the query you posted:
I just tested a similar query but added
require: falseas an option forsaveand it didn’t throw an error.