updateWhere()

Modifies all entities that match the given filter using the provided callback.

An exception is thrown if the entity has not been inserted into the table before, e.g. if the primary key of the entity was not found.

// Happy Birthday! Increase the age of all 20 year olds to 21
await updateWhere(userTable, { where: { age: 20 } }, (user) => {
  return { ...user, age: user.age + 1 };
});
Parameter Description
table The table created by createTable() .
filter Only items which match the filter will be modified. See filters.
callback Called for every item. The return value of the callback will set the corresponding properties on the item.
blinkDB © 2023