Searching by null returns no results

Given an example model like this:
model Item {
name: String
ownedBy: String?
}
model Item {
name: String
ownedBy: String?
}
When I try and search like this:
prisma.item.findFirst({
where: {
ownedBy: null
}
});
prisma.item.findFirst({
where: {
ownedBy: null
}
});
It returns nothing - while expected result would be to get the first item that isn't owned by anyone.
2 Replies
Prisma AI Help
You decided to hold for human wisdom. We'll chime in soon! Meanwhile, #ask-ai is there if you need a quick second opinion.
Nurul
Nurul4d ago
Hey! What happens when you try this query?
prisma.item.findFirst({
where: {
ownedBy: {
equals: null
}
}
});
prisma.item.findFirst({
where: {
ownedBy: {
equals: null
}
}
});

Did you find this page helpful?