does prisma support search on embedded fields? I j...
# mongodb
p
does prisma support search on embedded fields? I just can't make such query work:
Copy code
const res = await prisma.m.findFirst({
  where: {
    a: {
      b: {
        c: 'd'
      }
    }
  },
});
where my schema looks like
Copy code
enum C {
  a
  b
  c
  d
}

type B {
  c          C
  otherField String
}

type A {
  b          B
  otherField String
}

model M {
  id         String @id @default(auto()) @map("_id") @db.ObjectId
  a          A
  otherField String
}
It fails both on TS level and runtime. it feels like it's mandatory to specify the values of
otherField
as well, but that makes no sense 😞
wow. if I specify all the embedded fields,
otherField
included, it starts to work. as for me, that sounds like a serious bug 😄 mandatory fields should be mandatory only for
create
operation, but not for
findFirst
👀 2
j
Issue pls.
Thanks for following through, I could reproduce what you described: https://github.com/prisma/prisma/issues/12830#issuecomment-1104295912
p
thank you!