{ "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