[PR #4449] [MERGED] feat: add support for not in operator #13640

Closed
opened 2026-04-13 09:02:37 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4449
Author: @Bekacru
Created: 9/5/2025
Status: Merged
Merged: 9/5/2025
Merged by: @Bekacru

Base: canaryHead: feat/not-in


📝 Commits (4)

📊 Changes

8 files changed (+95 additions, -1 deletions)

View changed files

📝 packages/better-auth/src/adapters/drizzle-adapter/drizzle-adapter.ts (+18 -0)
📝 packages/better-auth/src/adapters/kysely-adapter/kysely-adapter.ts (+8 -0)
📝 packages/better-auth/src/adapters/kysely-adapter/test/state.txt (+1 -1)
📝 packages/better-auth/src/adapters/memory-adapter/memory-adapter.ts (+6 -0)
📝 packages/better-auth/src/adapters/mongodb-adapter/mongodb-adapter.ts (+9 -0)
📝 packages/better-auth/src/adapters/prisma-adapter/prisma-adapter.ts (+2 -0)
📝 packages/better-auth/src/adapters/test.ts (+50 -0)
📝 packages/better-auth/src/types/adapter.ts (+1 -0)

📄 Description

we currently don't support not_in as operator for adapter queries


Summary by cubic

Add support for the not_in operator across all adapters to allow filtering records that exclude a set of values (e.g., id not in [...]). This enables consistent query behavior in find/findMany across databases.

  • New Features
    • Drizzle: maps to notInArray; validates value is an array and throws otherwise.
    • Kysely: maps to "not in" (coerces single value to array).
    • MongoDB: maps to $nin with proper ID serialization.
    • Prisma: maps to notIn in operator translation.
    • Types: adds "not_in" to Where.operator.
    • Tests: adds findMany test case for excluding IDs.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/4449 **Author:** [@Bekacru](https://github.com/Bekacru) **Created:** 9/5/2025 **Status:** ✅ Merged **Merged:** 9/5/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `feat/not-in` --- ### 📝 Commits (4) - [`68ede0a`](https://github.com/better-auth/better-auth/commit/68ede0a8b0e99bb9c60d64aba9e49edc7333b786) feat: supprot not in operator - [`510db4a`](https://github.com/better-auth/better-auth/commit/510db4a9f71daae03d52aa2fcef95536450450ae) fix test - [`36ea062`](https://github.com/better-auth/better-auth/commit/36ea0629dad6bfbcf6aa026be9fb24253fc55de2) memory adapter - [`df3c22e`](https://github.com/better-auth/better-auth/commit/df3c22e6ba368b6cfb106da7d866a820bde96638) chore: remove comments ### 📊 Changes **8 files changed** (+95 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/adapters/drizzle-adapter/drizzle-adapter.ts` (+18 -0) 📝 `packages/better-auth/src/adapters/kysely-adapter/kysely-adapter.ts` (+8 -0) 📝 `packages/better-auth/src/adapters/kysely-adapter/test/state.txt` (+1 -1) 📝 `packages/better-auth/src/adapters/memory-adapter/memory-adapter.ts` (+6 -0) 📝 `packages/better-auth/src/adapters/mongodb-adapter/mongodb-adapter.ts` (+9 -0) 📝 `packages/better-auth/src/adapters/prisma-adapter/prisma-adapter.ts` (+2 -0) 📝 `packages/better-auth/src/adapters/test.ts` (+50 -0) 📝 `packages/better-auth/src/types/adapter.ts` (+1 -0) </details> ### 📄 Description we currently don't support `not_in` as operator for adapter queries <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Add support for the not_in operator across all adapters to allow filtering records that exclude a set of values (e.g., id not in [...]). This enables consistent query behavior in find/findMany across databases. - **New Features** - Drizzle: maps to notInArray; validates value is an array and throws otherwise. - Kysely: maps to "not in" (coerces single value to array). - MongoDB: maps to $nin with proper ID serialization. - Prisma: maps to notIn in operator translation. - Types: adds "not_in" to Where.operator. - Tests: adds findMany test case for excluding IDs. <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 09:02:37 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#13640