mongodb 建立索引提示异常:WiredTigerIndex::insert: key too large to index, failing 1483


{
    "ok" : 0.0,
    "errmsg" : "WiredTigerIndex::insert: key too large to index, failing  1483 { : \"山东隔断|山东隔断厂家|山东隔断价格|山东活动隔断|山东酒店活动隔断|烟台活动玻璃隔断|山东活动展板|山东隔��...\" }",
    "code" : 17280
}

MongoDB will not create an index on a collection if the index entry for an existing document exceeds the index key limit (1024 bytes). You can however create a hashed index or text index instead:

db.logcollection.ensureIndex({"Module":"hashed"})

or

db.logcollection.ensureIndex({"Module":"text"})

mongodb 对字段中有超过 1024 字节的不会建立索引,但是可以使用text 索引或者hashed 索引来实现。

关于各种索引的区别请看:http://www.mongoing.com/archives/2797

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM