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