How to define a second where criteria with Prisma ...
# orm-help
k
How to define a second where criteria with Prisma 2 to be able to query with?
Copy code
where: {
      myCustomId: String(id)
    }
Basically I want to query with the default ID but also with another one
@Ryan Sorry for the ping but that is the last blocking feature before I can finish a project. Can you help?
r
Hey @ksch 👋 you want to pass the id in a
where
clause?
k
Updated question above. Prisma tells me that I can only use the id (default) in the where clause.
Copy code
Unknown arg `customId` in where.customId for type TestWhereUniqueInput. Available args:

type TestWhereUniqueInput {
  id?: String
}
r
Is your
myCustomId
field unique? And you're using
findOne
?
k
I want to use
.update()
the field value is unique but not in the schema. Is it enough to give it the
@unique
attr?
r
If your provide the
@unique
attr, you will be able to
k
Great thanks! 🎉 Last question is there another way if a value cannot be unique? Is there like another filter method to get items by a field with non unique values?
r
You would have to use
findMany
then 🙂
👍 1