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
Yetzederixx5d ago
That's a good question, do you have a specific error message you can share?
jsoneaday
jsoneadayOP5d ago
When I set a local Omit it tells me the type is never
Nurul
Nurul4d ago
Have you enabled omitApi preview feature?
Nurul
Nurul4d ago
generator client {
provider = "prisma-client-js"
previewFeatures = ["omitApi"]
}
generator client {
provider = "prisma-client-js"
previewFeatures = ["omitApi"]
}
jsoneaday
jsoneadayOP4d 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,
});
Want results from more Discord servers?
Add your server