// Use with update to set current timestamp
User.update({ lastLogin: literal('NOW()') }, { where: { ... } })
// Use in where clause to compare with current time
User.findAll({
where: {
createdAt: { [Op.lt]: literal('NOW()') }
}
})
// Compare column to a literal value
User.findAll({
where: {
updatedAt: { [Op.gt]: literal('createdAt') }
}
})
Create a literal SQL expression (inserted as-is into the query) Returns { $literal: value } format for raw SQL expressions Use with caution - this can lead to SQL injection if user input is included