Skip to content
VibORM
Esc
navigateopen⌘Jpreview
On this page

String Filters

Filter operators for string scalars

Operators

Operator Description
equals Exact match
not Not equal
in Match any in array
notIn Match none in array
lt / lte Sorts before (exclusive / inclusive)
gt / gte Sorts after (exclusive / inclusive)
contains Contains substring
startsWith Starts with prefix
endsWith Ends with suffix
mode Case sensitivity

equals, not, in, and notIn work the same on every scalar type — see Filtering.

contains

// Contains substring
where: { name: { contains: "alice" } }

// Case insensitive
where: { name: { contains: "alice", mode: "insensitive" } }

startsWith / endsWith

// Starts with
where: { email: { startsWith: "admin" } }

// Ends with
where: { email: { endsWith: "@company.com" } }

// Case insensitive
where: { email: { endsWith: "@company.com", mode: "insensitive" } }

mode (Case Sensitivity)

// Default: case sensitive
where: { name: { contains: "Alice" } }

// Case insensitive
where: { name: { contains: "alice", mode: "insensitive" } }

mode: "insensitive" applies to equals, not, in, notIn, contains, startsWith, and endsWith.

Insensitive mode folds ASCII A-Z only. Non-ASCII code points remain exact on every database, which keeps the result independent of provider collations and optional Unicode/ICU extensions.

Default string equality, membership, and substring filters are case-sensitive on every supported database, independent of its default collation.

Examples

Search Function

async function searchUsers(query: string) {
  return client.user.findMany({
    where: {
      OR: [
        { name: { contains: query, mode: "insensitive" } },
        { email: { contains: query, mode: "insensitive" } },
        { bio: { contains: query, mode: "insensitive" } },
      ],
    },
    take: 20,
  });
}

Was this page helpful?