prisma-client-api-filters

от prisma

Условия и операторы фильтрации

npx skills add https://github.com/prisma/cursor-plugin --skill prisma-client-api-filters

Filter Conditions and Operators

Filter operators for the where clause.

Equality

// Exact match (implicit)
where: { email: 'alice@prisma.io' }

// Explicit equals
where: { email: { equals: 'alice@prisma.io' } }

// Not equal
where: { email: { not: 'alice@prisma.io' } }

Comparison

// Greater than
where: { age: { gt: 18 } }

// Greater than or equal
where: { age: { gte: 18 } }

// Less than
where: { age: { lt: 65 } }

// Less than or equal
where: { age: { lte: 65 } }

// Combined
where: { age: { gte: 18, lte: 65 } }

Lists

// In array
where: { role: { in: ['ADMIN', 'MODERATOR'] } }

// Not in array
where: { role: { notIn: ['GUEST', 'BANNED'] } }

String Filters

// Contains
where: { email: { contains: 'prisma' } }

// Starts with
where: { email: { startsWith: 'alice' } }

// Ends with
where: { email: { endsWith: '@prisma.io' } }

// Case-insensitive (default for some databases)
where: { 
  email: { 
    contains: 'PRISMA',
    mode: 'insensitive' 
  } 
}

Null Checks

// Is null
where: { deletedAt: null }

// Is not null
where: { deletedAt: { not: null } }

// Using isSet (for optional fields)
where: { middleName: { isSet: true } }

Logical Operators

AND (implicit)

// Multiple conditions = AND
where: {
  email: { contains: '@prisma.io' },
  role: 'ADMIN'
}

AND (explicit)

where: {
  AND: [
    { email: { contains: '@prisma.io' } },
    { role: 'ADMIN' }
  ]
}

OR

where: {
  OR: [
    { email: { contains: '@gmail.com' } },
    { email: { contains: '@prisma.io' } }
  ]
}

NOT

where: {
  NOT: {
    role: 'GUEST'
  }
}

// Multiple NOT conditions
where: {
  NOT: [
    { role: 'GUEST' },
    { verified: false }
  ]
}

Combined

where: {
  AND: [
    { verified: true },
    {
      OR: [
        { role: 'ADMIN' },
        { role: 'MODERATOR' }
      ]
    }
  ],
  NOT: { deletedAt: { not: null } }
}

Relation Filters

some

At least one related record matches:

// Users with at least one published post
where: {
  posts: {
    some: { published: true }
  }
}

every

All related records match:

// Users where all posts are published
where: {
  posts: {
    every: { published: true }
  }
}

none

No related records match:

// Users with no published posts
where: {
  posts: {
    none: { published: true }
  }
}

is / isNot (1-to-1)

// Users with profile in specific country
where: {
  profile: {
    is: { country: 'USA' }
  }
}

// Users without profile
where: {
  profile: {
    isNot: null
  }
}

Array Field Filters

For fields like String[]:

// Has element
where: { tags: { has: 'typescript' } }

// Has some elements
where: { tags: { hasSome: ['typescript', 'javascript'] } }

// Has every element
where: { tags: { hasEvery: ['typescript', 'prisma'] } }

// Is empty
where: { tags: { isEmpty: true } }

JSON Filters

// Path-based filter
where: {
  metadata: {
    path: ['settings', 'theme'],
    equals: 'dark'
  }
}

// String contains in JSON
where: {
  metadata: {
    path: ['bio'],
    string_contains: 'developer'
  }
}

Full-Text Search

// Requires @@fulltext index
where: {
  content: {
    search: 'prisma database'
  }
}

Больше skills от prisma

prisma-cli-migrate-reset
prisma
prisma migrate reset
official
prisma-cli-validate
prisma
prisma validate. Справочная информация при использовании этой функции Prisma.
official
prisma-next-extension-upgrade
prisma
Upgrade Prisma Next in your extension. Bumps every `@prisma-next/*` dependency to the requested target (or npm `latest`), runs the per-transition upgrade…
official
adr-review
prisma
Проверить один или несколько ADR свежим взглядом (как участник команды без предварительного контекста), выявить проблемы в повествовании и структуре, затем переписать их. Используйте, когда…
official
prisma-next-upgrade
prisma
Upgrade Prisma Next in your app. Bumps every `@prisma-next/*` dependency from the version pinned in the lockfile to the requested target (or npm `latest`),…
official
prisma-cli
prisma
Полное руководство по командам, опциям и рабочим процессам Prisma CLI для настройки, миграций и операций с базами данных. Охватывает более 20 команд, сгруппированных по приоритету: настройка (init), генерация (generate), разработка (dev), операции с базами данных (db pull/push/seed/execute) и миграции (migrate dev/deploy/reset/status/diff/resolve). Включает изменения в Prisma 7.x: новый файл конфигурации prisma.config.ts, удаленные флаги (--skip-generate, --skip-seed, --schema, --url) и явные...
official
prisma-client-api
prisma
Полный справочник API Prisma Client для запросов к моделям, операций CRUD, фильтрации, связей и транзакций. Охватывает 17 методов запросов к моделям, включая findUnique, findMany, create, update, delete, upsert и массовые операции с вариантами возврата. Предоставляет опции запросов для формирования результатов: select, include, omit, orderBy, take, skip, cursor и distinct. Включает скалярные и логические операторы фильтрации (equals, in, contains, startsWith, lt, gt), а также фильтры по связям (some,...
official
prisma-compute
prisma
Prisma Compute deployment and hosting guide. Use whenever the user mentions Prisma Compute, `prisma.compute.ts`, `defineComputeConfig`, deploying or hosting a Prisma app, `@prisma/cli app deploy`, `compute:deploy`, `create-prisma --deploy`, `PRISMA_SERVICE_TOKEN`, `auth workspace`, Compute apps/deployments/build logs/domains, `@prisma/cli agent install`, localhost vs `0.0.0.0`, deploy port binding, or framework deploy readiness for Hono, Elysia, Next.js, TanStack Start, Astro, Nuxt, Svelte,...
developmentdevopsofficial