Version: v0.6.0 - Beta.  We welcome contributors & feedback.  THanks!

Db.updateRows

Db.updateRows($table, $colMap, $whereSql)

Description

Update 1 or more rows of a table, if they exist.

// Archive posts that are older than 90 days
$archiveDate = Date.now() - Date.days(90);
$where = sql'created < {}'.fill($archiveDate);

Db.updateRows('posts', { isArchive: 1 }, $where);

// Runs this query:
// UPDATE posts SET archive=1 WHERE created < 1490492523