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