Passing undefined to update updates all rows
Summary
Passing undefined to update updates all rows
Example
Code demonstrating the behavior
// This updates all rows with the new values
const id = undefined;
await this.db.users.update(id, {
firstName: 'First',
lastName: 'Last',
});
// This updates nothing
const id = undefined;
await this.db.users.update(
{id},
{
firstName: 'First1',
lastName: 'Last1',
},
);
Expected behavior
Nothing should update in both cases
Actual behavior
firstName and lastName are updated on all rows!
Additional context
This seems like an extremely dangerous result for a minor miss.
Edited by Darrin Grove