Database to Table, back to database (ranked)

I am trying to create some code that will display certain items from a database into a table.
The table ranks the items.
And then I want it to update the database with these ranks.

So far I have…

wixData.query(“M-League”)
.descending(“points”)
.find()
.then((results) => {
console.log(results.items);
const rowsToLoad = results.items.map((r, i) => {
return { “streak”: r.streak, “name”: r.name, “points”: r.points, “rank”: i + 1 }
})
console.log(rowsToLoad);
$w(“#leagueTable”).rows = rowsToLoad;
});

What this does is retrieves items from dataset and ranks them in a table, with the ranks displayed.
I have been trying to update this data back into the database with the ranks entered in the ‘rank’ column of the database but with no luck so far.
The database has more columns than just the four displayed in the table (streak, name, points, rank)

Can anyone help please?

Thats a great quiestion
@jonatandor35 @ahmadnasriya