BlinkDB Logo blinkDB

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 };
});
ParameterDescription
tableThe table created by createTable() .
filterOnly items which match the filter will be modified. See filters.
callbackCalled for every item. The return value of the callback will set the corresponding properties on the item.