String operations:
.where('name').startsWith('John')
.where('email').endsWith('@gmail.com')
.where('description').contains('important')
.where('name').matches(/^[A-Z]/)
Better range syntax:
.where('age').between(18, 65) // More intuitive than range()
.where('price').notBetween(0, 10)
Array/Collection operations:
.where('tags').contains('typescript')
.where('skills').containsAny(['js', 'ts', 'node'])
.where('roles').containsAll(['admin', 'user'])
.where('id').in([1, 2, 3, 4])
.where('status').notIn(['deleted', 'archived'])
Logical operators:
.where('age').gte(18).or().where('hasParentalConsent').equals(true)
.where(qb => qb
.where('type').equals('premium')
.and('status').equals('active')
).or().where('isTrial').equals(true)
Aggregations:
await db.Order.query().sum('amount')
await db.Order.query().avg('price')
await db.Order.query().min('date')
await db.Order.query().max('date')
await db.Order.query().groupBy('status').count()
String operations:
Better range syntax:
Array/Collection operations:
Logical operators:
Aggregations: