v0.19.0 Release
-
Added
pb.filter(rawExpr, params?)
helper to construct a filter string with placeholder parameters populated from an object.const record = await pb.collection("example").getList(1, 20, { // the same as: "title ~ 'te\\'st' && (totalA = 123 || totalB = 123)" filter: pb.filter("title ~ {:title} && (totalA = {:num} || totalB = {:num})", { title: "te'st", num: 123 }) })
The supported placeholder parameter values are:
string
(single quotes will be autoescaped)number
boolean
Date
object (will be stringified into the format expected by PocketBase)null
- anything else is converted to a string using
JSON.stringify()