Filtering
Filtering is expressed through where maps.
Operator overview
Equality and negation
ballerina
.'where({
email: {equals: "alice@example.com"},
status: {not: "DELETED"}
})Comparison
ballerina
.'where({
age: {gt: 18, lte: 65}
})List membership
ballerina
.'where({
status: {'in: ["ACTIVE", "PENDING"]},
role: {notIn: ["BANNED"]}
})String matching
ballerina
.'where({
email: {contains: "@example.com"},
name: {startsWith: "A"},
username: {endsWith: "_dev"}
})Null checks
ballerina
.'where({
deletedAt: {isNull: true}
})Logical operators
ballerina
var rows = check db.'from(User)
.'where({
AND: [
{status: {equals: "ACTIVE"}},
{
OR: [
{email: {endsWith: "@example.com"}},
{email: {endsWith: "@test.com"}}
]
}
],
NOT: {
role: {equals: "BANNED"}
}
})
.findMany();Next step
Read Transactions or jump to Read Operations.