我有一个 MongoDB 集合。
我想改变索引,有一个双索引,而不是一个单一的。
所以我跑了:
db.allnews.ensureIndex( { "url": 1, "source": 1 }, { unique: true } )
Run Code Online (Sandbox Code Playgroud)
但后来我得到了错误:
exception: WiredTigerIndex::insert: key too large to index
Run Code Online (Sandbox Code Playgroud)
并且限制为 1024 字节
那么解决方案是什么...?
(1)以某种方式忽略它..以某种方式跳过这些太长的记录,而不停止整个过程..?
--setParameter failIndexKeyTooLong=false
Run Code Online (Sandbox Code Playgroud)
?? 这可以解决问题吗..?
(2) 查找过长的记录,通过某种查询,并缩短它们..?
(3) 还有什么..?