Operators

Basic

Learn the basic operators to build PocketBase queries.

Equality Checks

.equal(key, value)

Matches records where key equals value.

pbQuery<Post>().equal('author.name', 'Alice'); // name='Alice'
// This is case-sensitive. Use the `:lower` modifier for case-insensitive matching.
pbQuery<Post>().equal('author.name:lower', 'alice'); // name:lower='alice'

.notEqual(key, value)

Matches records where key is not equal to value.

pbQuery<Post>().notEqual('author.name', 'Alice'); // name!='Alice'
// This is case-sensitive. Use the `:lower` modifier for case-insensitive matching.
pbQuery<Post>().notEqual('author.name:lower', 'alice'); // name:lower!='alice'

.like(key, value)

Matches records where key contains value.

It is case-insensitive, so the :lower modifier is unnecessary.

pbQuery<Post>().like('author.name', 'Joh'); // name~'Joh' / name~'%Joh%'

.notLike(key, value)

Matches records where key doesn't contain value.

It is case-insensitive, so the :lower modifier is unnecessary.

pbQuery<Post>().notLike('author.name', 'Joh'); // name!~'Joh' / name!~'%Joh%'

Comparisons

.greaterThan(key, value)

Matches records where key is greater than value.

pbQuery<User>().greaterThan('age', 21); // age>21

.greaterThanOrEqual(key, value)

Matches records where key is greater than or equal to value.

pbQuery<User>().greaterThanOrEqual('age', 18); // age>=18

.lessThan(key, value)

Matches records where key is less than value.

pbQuery<User>().lessThan('age', 50); // age<50

.lessThanOrEqual(key, value)

Matches records where key is less than or equal to value.

pbQuery<User>().lessThanOrEqual('age', 65); // age<=65