Hey, if any of ya could give a quick hint on this ...
# orm-help
d
Hey, if any of ya could give a quick hint on this I'd greatly appreciate it! OR is driving me mad https://github.com/prisma/prisma/discussions/3030
n
Hmm, that looks strange indeed!
OR
should be available inside of
findMany
as documented here.
Copy code
const result = await prisma.post.findMany({
  where: {
    OR: [
      {
        title: { contains: 'Prisma' },
      },
      {
        title: { contains: 'databases' },
      },
    ],
  },
})
Can you share your schema (or the relevant parts therefore)? I'll try to reproduce the issue in an isolated environment 🙂
d
Hi @nikolasburk! Thanks a lot for getting in touch! The whole schema would be thousands of line long and under NDA, but I can try to cook up a minimal example
🙏 1
n
Ah I also just realized that you're using Prisma 1, the docs link I shared is for Prisma 2.
n
Yeah the API hasn't changed that much, I'd indeed expect it to be available in Prisma 1 as well 🤔
d
Ok that's actually interesting
Copy code
type Thing @db(name: "myMongoCollection") {
  _id: ID! @id
}
this generates
Copy code
export interface ThingWhereInput {
  _id?: string | null
  _id_not?: string | null
  _id_in?: string[]
  _id_not_in?: string[]
  _id_lt?: string | null
  _id_lte?: string | null
  _id_gt?: string | null
  _id_gte?: string | null
  _id_contains?: string | null
  _id_not_contains?: string | null
  _id_starts_with?: string | null
  _id_not_starts_with?: string | null
  _id_ends_with?: string | null
  _id_not_ends_with?: string | null
  AND?: ThingWhereInput[]
}
so my assumption about @relation doesn't seem to hold true
but for some types it generates
Copy code
export interface RoleScalarWhereInput {
  _id?: string | null
  _id_not?: string | null
  _id_in?: string[]
  _id_not_in?: string[]
  _id_lt?: string | null
  _id_lte?: string | null
  _id_gt?: string | null
  _id_gte?: string | null
  _id_contains?: string | null
  _id_not_contains?: string | null
  _id_starts_with?: string | null
  _id_not_starts_with?: string | null
  _id_ends_with?: string | null
  _id_not_ends_with?: string | null
  name?: string | null
  name_not?: string | null
  name_in?: string[]
  name_not_in?: string[]
  name_lt?: string | null
  name_lte?: string | null
  name_gt?: string | null
  name_gte?: string | null
  name_contains?: string | null
  name_not_contains?: string | null
  name_starts_with?: string | null
  name_not_starts_with?: string | null
  name_ends_with?: string | null
  name_not_ends_with?: string | null
  AND?: RoleScalarWhereInput[]
  OR?: RoleScalarWhereInput[]
  NOT?: RoleScalarWhereInput[]
}
Just want to highlight the fact that I'm using Prisma 1 with Mongo. Maybe there are some issues with it?
It's been removed from the Mongo version of Prisma. And not a word in the docs! This is BAD! https://github.com/prisma/prisma1/issues/3897