Not sure what's up. Using Prisma with a mongoDB connection. Trying to search the JSON tree for specific values that match the [key, value] from the loop. I haven't been able to get far enough to see if this implementation will work (I don't think it will) because the path property keeps giving an error. Below is my schema.prisma file and the error message being given back from the call back.
generator client {
provider = "prisma-client-js"
previewFeatures = [ "mongoDb", "filterJson"]
}
datasource db {
provider = "mongodb"
url = env("DATABASE_URL")
}
model User {
id String @id @default(dbgenerated()) @map("_id") @db.ObjectId
email String
options Json
password String
role String
}
Invalid `.findMany()` invocation
for (const [key, value] of Object.entries(filters)) {
return await prisma.user
ā .findMany({
where: {
options: {
path: key,
~~~~
equals: value
}
}
})
Unknown arg `path` in where.options.path for type JsonFilter. Did you mean `not`? Available args:
type JsonFilter {
equals?: Json
not?: Json
}
Have ran npx prisma generate several times. Included the "filterJson" feature as documented. Have googled everything I can and I can't seem to find out where I'm going wrong.
Any help?