Updating all values of a column of a database

Is there a way to update all the values of a column in a database?
(based on some other variables)

Currently I have…
allItems.forEach((record) => {
record.columnname = value
wixData.update(“DataCollection”, record);
});

This updates 1 column, but with the same value, and keeps all other columns as they were previously.
Can something like this be done but where there are different values updated for each entry, depending on other factors?

Hi Eaton,

I take it that allItems is an array produced by wixData.query. You could use the JavaScript switch statement inside your forEach loop to apply the different logic to update the other values in that array row, which you would then update the collection with.