【发布时间】:2016-08-07 15:01:40
【问题描述】:
我有一个 MongoDB 集合。
我想更改索引,使用双索引,而不是单索引。
所以我跑了:
db.allnews.ensureIndex( { "url": 1, "source": 1 }, { unique: true } )
然后我得到错误:
exception: WiredTigerIndex::insert: key too large to index
并且限制为 1024 字节
那么解决办法是什么...?
(1) 以某种方式忽略它.. 以某种方式跳过这些太长的记录,而不停止整个过程..?
--setParameter failIndexKeyTooLong=false
??这可以解决问题吗..?
(2)通过某种查询,找到过长的记录,并缩短它们..?
(3) 别的东西..?
【问题讨论】: