I have `javascript-client` client generated in via...
# orm-help
s
I have
javascript-client
client generated in via docker
prismagraphql/prisma:1.34
, I'm trying perform or operation like
prisma.posts({where: {OR:[...filters]} })
but unable to find any OR field. I have AND field generated and exported though. Any Community help highly appreciated.
r
Hey Sohail 👋 Could you share your schema if possible?
👋 1
s
here' my schema
Copy code
type Post {
    id: ID! @id
    feedlyId: String @unique
    title: String
    author: String
    language: String
    crawled: DateTime
    canonicalUrl: String
    engagement: Float
    published: DateTime
    updated: DateTime
    picture: String
    content: String
    summary: String
    categories: [Category!] @relation(link: INLINE)
    updatedAt: DateTime! @updatedAt
}
type Category {
    id: ID! @id
    catId: String! @unique
    label: String
    posts: [Post!]
}

type User {
    id: ID!  @id
    name: String
    email: String
    login: String
    user_id: Int @unique
}
f
I think you might be missing the
where
clause in your request 😄
Copy code
prisma.posts({ where: { OR: [...filters] } })
😁 1
s
sorry i'm trying it in where.
@Florian @Ryan in
PostWhereInput
I have an `AND`field but not any
OR
field in
index.d.ts
f
oh, weird thing indeed ^^
😨 1
s
I dont know why its not exported, what do suggest, should I upgrade the prisma version in docker and check?
f
idk, i'm using 1.34.10 with
typescript-client
as generator and it's working well :v
maybe trying to clean the files and regenerate everything could work?
s
i tried it didnt work 😞
😕 1
r
Could you run
npx prisma1 generate
and try again. I tried your schema and it's working on version 1.34.10
s
ok let me try
it generates successfully but only contains AND
I have tried TS client
typescript-client
and it generates an OR property but not
javascript-client
thanks docker recreating clean with 1.34.10 fixed it 🙂
@Ryan @Florian thanks for support 🙂
😄 1
this still included the or in scalar input with is only applicable in deleteMany or updateMany
@Ryan @Florian I have even tried in typescript, Scalar input have OR but not normal
PostWhereInput
. any other suggestion?
please help guys.
@Ryan final ask, can u guide me if I can switch to
findMany
only for this query, because its not exporting the OR in
PostWhereInput
?
r
Start with a clean database not on your old one. This is my docker-compose.yml:
Copy code
version: '3'
services:
  prisma:
    image: prismagraphql/prisma:1.34.10
    restart: always
    ports:
      - '4466:4466'
    env_file:
      - .env
    environment:
      JAVA_OPTS: '-Xmx1350m'
      PRISMA_CONFIG: |
        port: 4466
        # uncomment the next line and provide the env var PRISMA_MANAGEMENT_API_SECRET=secret123 to activate cluster security
        # managementApiSecret: ${PRISMA_MANAGEMENT_API_SECRET}
        databases:
          default:
            connector: postgres
            host: host.docker.internal
            database: prisma1
            schema: prisma1
            user: postgres
            password: password
            ssl: false
            rawAccess: true
            port: '5432'
            migrations: true
This is my prisma.yml:
Copy code
endpoint: <http://localhost:4466>
datamodel: datamodel.graphql

generate:
  - generator: javascript-client
    output: ./generated/prisma-client/
Run the following commands:
Copy code
docker-compose up -d
npx prisma1 generate
You will get the OR type as well now for PostWhereInput
Also this is my
datamodel.graphql
Copy code
type Post {
  id: ID! @id
  feedlyId: String @unique
  title: String
  author: String
  language: String
  crawled: DateTime
  canonicalUrl: String
  engagement: Float
  published: DateTime
  updated: DateTime
  picture: String
  content: String
  summary: String
  categories: [Category!] @relation(link: TABLE)
  updatedAt: DateTime! @updatedAt
}

type Category {
  id: ID! @id
  catId: String! @unique
  label: String
  posts: [Post!]
}

type User {
  id: ID! @id
  name: String
  email: String
  login: String
  user_id: Int @unique
}
👍 1
s
thanks found the issue, I was using
databaseType: document
in
prisma.yml
. removing it added 'OR' field. Thanks for putting this much effort.
💯 1
OR is present in
*PostWhereInput*
but errors remains the same I've regenerated even. maybe because I'm using mongo?
r
Yes Mongo doesn't support this. There is an issue for that here. You would need to switch to a relational DB to use OR.