Backend & APISûr100100/100

Prisma Client API Filters (Prisma)

Filter Conditions and Operators

ou envoie-le directement à ton agent.

Installer dans ton projet

$ curl -fsSL https://arboristhree.xyz/cli/install-skill.mjs -o /tmp/arboris-install-skill.mjs && node /tmp/arboris-install-skill.mjs prisma-client-api-filters__prisma-cursor-plugin__skills-07765aa2bde5
Prisma
prisma/cursor-plugin
Contenu à copier
---
name: prisma-client-api-filters
description: Filter Conditions and Operators
license: MIT
metadata:
  origin: Prisma
  author: prisma
  version: "7.0.0"
---

# Filter Conditions and Operators

Filter operators for the `where` clause.

## Equality

```typescript
// 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

```typescript
// 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

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

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

## String Filters

```typescript
// 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

```typescript
// 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)

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

### AND (explicit)

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

### OR

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

### NOT

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

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

### Combined

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

## Relation Filters

### some

At least one related record matches:

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

### every

All related records match:

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

### none

No related records match:

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

### is / isNot (1-to-1)

```typescript
// 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[]`:

```typescript
// 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

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

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

## Full-Text Search

```typescript
// Requires @@fulltext index
where: {
  content: {
    search: 'prisma database'
  }
}
```
Colle ce Markdown dans ton agent ou utilise les boutons ci-dessus pour l’écrire dans ton projet.

Ce que fait Prisma Client API Filters (Prisma)

Applique les pratiques du skill prisma-client-api-filters__prisma-cursor-plugin__skills-07765aa2bde5.

Comment utiliser Prisma Client API Filters (Prisma)

1
Copie le prompt
Un clic copie le prompt packagé (ou l'envoie à ton agent).
2
L'agent installe le skill
Il ajoute le SKILL.md et ses ressources à ton projet.
3
Activation automatique
Le skill s'active dès que le contexte correspond.

Déclencheurs pour Prisma Client API Filters (Prisma)

Dis simplement à ton agent quelque chose comme :

Applique le skill prisma-client-api-filters__prisma-cursor-plugin__skills-07765aa2bde5 à cette tâche
Utilise prisma-client-api-filters__prisma-cursor-plugin__skills-07765aa2bde5 pour améliorer cette implémentation
Passe en revue ce sujet avec prisma-client-api-filters__prisma-cursor-plugin__skills-07765aa2bde5

Skills liés à Prisma Client API Filters (Prisma)