Werdox
Werdox
Explore posts from servers
PPrisma
Created by Werdox on 6/19/2024 in #help-and-questions
omit with condition
I want to only omit certain fields if a condition in the same thing I'm querying is true example:
const channels = await prisma.channel.findMany({
where: { ownerId: userId },
omit: { name: /* Only omit 'name' if the channel type is 1 */ },
});
const channels = await prisma.channel.findMany({
where: { ownerId: userId },
omit: { name: /* Only omit 'name' if the channel type is 1 */ },
});
11 replies