Why is omit not available for this query?

I am using prisma 5.21.1. If I try this call omit is not available why?
client.profile.findFirst({
omit: {
password: true,
},
where: {
id: profileId,
},
});
client.profile.findFirst({
omit: {
password: true,
},
where: {
id: profileId,
},
});
7 Replies
Yetzederixx
Yetzederixx2mo ago
That's a good question, do you have a specific error message you can share?
jsoneaday
jsoneadayOP2mo ago
When I set a local Omit it tells me the type is never
Nurul
Nurul2mo ago
Have you enabled omitApi preview feature?
Nurul
Nurul2mo ago
generator client {
provider = "prisma-client-js"
previewFeatures = ["omitApi"]
}
generator client {
provider = "prisma-client-js"
previewFeatures = ["omitApi"]
}
jsoneaday
jsoneadayOP2mo ago
I was surprised that it's still in beta. I've enabled it but cannot get it to work for this query where my author has a password that I want to omit.
const authors = await this.#client.work.findMany({
select: {
author: {
include: {
works: {
include: {
workLikes: true,
},
},
},
},
},
orderBy: {
workLikes: {
_count: SortOrder.Desc,
},
},
take: size,
});
const authors = await this.#client.work.findMany({
select: {
author: {
include: {
works: {
include: {
workLikes: true,
},
},
},
},
},
orderBy: {
workLikes: {
_count: SortOrder.Desc,
},
},
take: size,
});
Nurul
Nurul2mo ago
Want results from more Discord servers?
Add your server