Closed dragon-fish closed 1 year ago
あれ?Me same problem got. Me thought that was my configuration broken somehow, so it IS a bug of mongo adapter currently?
这里用的是 $exists 来判断,或许需要改成 null check。
草,将 $exists: true
改成 $ne: null
以后插入和删除数据都会卡死,我不会了。
cc @undefined-moe
这个 keys 是表示啥 具体需要实现啥样的功能啊
另 可能需要提供 mongodb 版本
这个 keys 是表示啥 具体需要实现啥样的功能啊
keys 是构成一个复合唯一键的 key 列表。这里的 spec 实现了一个唯一键 (忽略空值)。
如果空值的行为是设置为 null 的话那看起来 {$ne:null} 不会有问题(?
虽然根据文档描述,似乎不支持 $ne operator(?
也可能是我理解错 equality exprs 了
如果空值的行为是设置为 null 的话那看起来 {$ne:null} 不会有问题(?
现在的问题是用了 $ne
直接就卡死了。
看起来他们也没有支持 $not
。
$ne 是 $not$eq 的缩写而已。
那有没有办法用上面提供的操作符实现一个 $ne 呢?
{$and:[{$type:'boolean'},{$type:'number'},...]}
虽然我更建议不要存 null,而是把字段删掉。
{$and:[{$type:'boolean'},{$type:'number'},...]}
这是 $or
吧?不过似乎直接根据 type 就可以。
虽然我更建议不要存 null,而是把字段删掉。
我不记得我有存其实……
坏了 不支持 $or 那没戏了
但报错信息确实是因为 null 的 duplicate
如果不存 null 进去的话直接使用 {sparse: true}
就可以了。
试了一种比较扭曲的做法,希望可用。
@dragon-fish 更新后你可能需要在 compass 中手动删一下相关 index 再启动 koishi。
Describe the bug
从 plugin-mongo 3.6.1 升级到 4.0 后,启动时报错,bot 无响应。
Steps to reproduce
bot同时安装过多个适配器时,会造成 user 表内部分文档包含形如
{ onebot: null }
的字段,它们被用作 unique index,引发报错Expected behavior
不报错
Screenshots
启动日志供参考
Versions
Additional context
No response