[GH-ISSUE #2468] NE filter operator not working with Prisma #9205

Closed
opened 2026-04-13 04:35:58 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @valerioXplo on GitHub (Apr 28, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/2468

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

This is the query i'm using:

 await authClient.admin.listUsers(
        {
          query: {
            filterField: "role",
            filterOperator: "ne",
            filterValue: "admin",
          },

Current vs. Expected behavior

I'm trying to search users that has role different than admin but i've noticed that it does not return any user.
I've activated the debugger in prisma and it print me this error:

return await db[model].findMany({
         where: {
           role: {
             ne: "admin",
             ~~
       ?     equals?: String | StringFieldRefInput | Null,
       ?     in?: String[] | ListStringFieldRefInput | Null,
       ?     notIn?: String[] | ListStringFieldRefInput | Null,
       ?     lt?: String | StringFieldRefInput,
       ?     lte?: String | StringFieldRefInput,
       ?     gt?: String | StringFieldRefInput,
       ?     gte?: String | StringFieldRefInput,
       ?     contains?: String | StringFieldRefInput,
       ?     startsWith?: String | StringFieldRefInput,
       ?     endsWith?: String | StringFieldRefInput,
       ?     mode?: QueryMode,
       ?     not?: String | NestedStringNullableFilter | Null
           }
         },
         take: 100,
         skip: 0
       })

Unknown argument `ne`. Did you mean `in`? Available options are marked with ?.

What version of Better Auth are you using?

1.2.7

Provide environment information

- OS: mac
- browser: chrome 
- db: prisma
- app: nextjs

Which area(s) are affected? (Select all that apply)

Backend

Auth config (if applicable)

import { betterAuth } from "better-auth"
export const auth = betterAuth({
  emailAndPassword: {  
    enabled: true
  },
  plugins: [
    admin(),
    bearer(),
    magicLink()
  ]
});

Additional context

Hi, i've noticed an error while searching user using the "ne" filteroperator.
I'm trying to search users that has role different than admin but i've noticed that it does not return any user.

We noticed that this issue was already reported and marked as fixed but, like other guy said it doesn't return anything.

Originally created by @valerioXplo on GitHub (Apr 28, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/2468 ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce This is the query i'm using: ``` await authClient.admin.listUsers( { query: { filterField: "role", filterOperator: "ne", filterValue: "admin", }, ``` ### Current vs. Expected behavior I'm trying to search users that has role different than admin but i've noticed that it does not return any user. I've activated the debugger in prisma and it print me this error: ``` return await db[model].findMany({ where: { role: { ne: "admin", ~~ ? equals?: String | StringFieldRefInput | Null, ? in?: String[] | ListStringFieldRefInput | Null, ? notIn?: String[] | ListStringFieldRefInput | Null, ? lt?: String | StringFieldRefInput, ? lte?: String | StringFieldRefInput, ? gt?: String | StringFieldRefInput, ? gte?: String | StringFieldRefInput, ? contains?: String | StringFieldRefInput, ? startsWith?: String | StringFieldRefInput, ? endsWith?: String | StringFieldRefInput, ? mode?: QueryMode, ? not?: String | NestedStringNullableFilter | Null } }, take: 100, skip: 0 }) Unknown argument `ne`. Did you mean `in`? Available options are marked with ?. ``` ### What version of Better Auth are you using? 1.2.7 ### Provide environment information ```bash - OS: mac - browser: chrome - db: prisma - app: nextjs ``` ### Which area(s) are affected? (Select all that apply) Backend ### Auth config (if applicable) ```typescript import { betterAuth } from "better-auth" export const auth = betterAuth({ emailAndPassword: { enabled: true }, plugins: [ admin(), bearer(), magicLink() ] }); ``` ### Additional context Hi, i've noticed an error while searching user using the "ne" filteroperator. I'm trying to search users that has role different than admin but i've noticed that it does not return any user. We noticed that this issue was already reported and marked as fixed but, like other [guy](https://github.com/better-auth/better-auth/issues/754#issuecomment-2618780236) said it doesn't return anything.
GiteaMirror added the locked label 2026-04-13 04:35:58 -05:00
Author
Owner

@valerioXplo commented on GitHub (Apr 28, 2025):

I added to this function:

a0728a88db/packages/better-auth/src/adapters/prisma-adapter/prisma-adapter.ts (L65)

that case:

        case "ne":
          return "not";

and seems working. I don't create a PR because I don't know if there are better way to fix this.

<!-- gh-comment-id:2834566448 --> @valerioXplo commented on GitHub (Apr 28, 2025): I added to this function: https://github.com/better-auth/better-auth/blob/a0728a88db321625982029af345e9bc180b3db12/packages/better-auth/src/adapters/prisma-adapter/prisma-adapter.ts#L65 that case: ``` case "ne": return "not"; ``` and seems working. I don't create a PR because I don't know if there are better way to fix this.
Author
Owner

@Kinfe123 commented on GitHub (May 29, 2025):

please try out the latest version for this. it should be working!

<!-- gh-comment-id:2920374547 --> @Kinfe123 commented on GitHub (May 29, 2025): please try out the latest version for this. it should be working!
Author
Owner

@matteovava commented on GitHub (May 30, 2025):

@Kinfe123 the error is still here, i've tried right now with 1.2.9-beta.6 and ne is not working.
I've tried also to use not but its not in definition therefore return error.

Image

<!-- gh-comment-id:2922665165 --> @matteovava commented on GitHub (May 30, 2025): @Kinfe123 the error is still here, i've tried right now with 1.2.9-beta.6 and ne is not working. I've tried also to use not but its not in definition therefore return error. ![Image](https://github.com/user-attachments/assets/ce8e5777-cfc0-4a2f-af3f-66b67372be74)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#9205