Reputation: 89
I'm trying to filter a user by email, I am using prisma and doing tests with the "playground", is there any way to filter the user's data by email?
My schema:
interface Model {
id: ID! @id
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
type User implements Model {
id: ID! @id
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
username: String
name: String!
surname: String!
email: String!
token_usuario: String! @unique
}
My attempts:
Upvotes: 1
Views: 875
Reputation: 6884
Using prisma 2.0, the db client exposes something like this:
ctx.prisma.user.findMany({
where: {
email: { contains: "something" }
}
});
And I expect the query would follow suit. So try passing in the where
field for filtering. Would need to see the full schema to say for sure.
Upvotes: 1