Prisma 不等于 true,过滤不正确
如下所示,我正在运行Prisma Postgres过滤器查询。但是,当我添加不等于过滤器时,它最终会过滤所有内容并没有返回结果,而不会出错。我在做什么错?我有各种各样的条目,两个is_soundtrack false,true和null。所以我应该得到一些结果。我还评论了另一种使用不是
的方法,但是这也不起作用?
我想显示所有结果,其中IS_SOUNDTRACK不等于true。
const songs = await this.db.song.findMany({
where: {
name: {
contains: "test string,
},
// is_soundtrack: {
// not: true,
// },
NOT: {
is_soundtrack: true,
},
},
orderBy: {
spotifyImg640: 'desc',
}
})
I'm running a prisma postgres filter query, as below. However when I add the NOT equal to filter, it ends up filtering everything and returning no results, without an error. What am I doing wrong? I have a variety of entries with both is_soundtrack false, true and null. So I should be getting some results. I also commented out another approach to using NOT
, however this also doesn't work?
I'm wanting to show all results, where is_soundtrack does not equal true.
const songs = await this.db.song.findMany({
where: {
name: {
contains: "test string,
},
// is_soundtrack: {
// not: true,
// },
NOT: {
is_soundtrack: true,
},
},
orderBy: {
spotifyImg640: 'desc',
}
})
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
prisma将
iSNOT:true
转换为其中column<> true
不起作用。这就是我要做的:
Prisma converts
isNot: true
towhere column <> true
which does not work.This is what I had to do:
因此,您需要:
或:
或:
当前过滤器
不是IS_SOUNDTRACK = true
只能覆盖false,而是排除空值。在此处阅读手册。
So you need:
Or:
Or:
The current filter
NOT is_soundtrack = true
would only cover false, but exclude null values.Read the manual here.