如何在同一属性上查询Dexie查询的多个子句?
我有一系列的字符串,它在Dexie中被索引。 我需要编写一个查询,以搜索没有字符串(a)和字符串(b)的行。 我可以在第一个条件下进行,但是对于第二个条件,我不能在 notequal 之后的子句中应用,因为它返回了 collection ,并且在哪里只能在上应用。表对象
db.table.where('array').notEqual('String(a)').toArray()
是否可以在第一个子句中使用第二个,还是可以实现目标的其他方法?
编辑: 其他可能的解决方案,而不是多个条款。
db.table.toCollection(function (e) {
return (!e.array.includes('String(a)') && e.array.includes('String(b)'))
}).toArray()
I have a array of strings and it is indexed in dexie.
I need to write a query that searches for the rows that don't have a string(a) and has a string(b).
I can do it with 1st condition, but for second condition, I can't apply where clause after notEqual as it returns collection and where can be applied only on table object
db.table.where('array').notEqual('String(a)').toArray()
Is it possible to apply second where clause, or is there any other approach to achieve the goal?
EDIT:
Other possible solutions, not with multiple where clauses.
db.table.toCollection(function (e) {
return (!e.array.includes('String(a)') && e.array.includes('String(b)'))
}).toArray()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你可以这样做
You can do this like