在MongoDB中存储长string会导致插入错误

我正在为我的大学构build一个类似于论坛的web应用程序,我正在实现的一个function是为用户编写针对特定考试试卷的答案的CRUDfunction。 但是,在testing过程中我发现,由于索引错误,我无法将string存储在答案文档的“详细信息”部分,如图所示。

{"success":false,"errors":["Exception: WriteError({\"code\":17280,\"index\":0,\"errmsg\":\"Btree::insert: key too large to index, failing maths_pyp.answers.$details_1 2265 { : \\\".... 

我在Express中使用了MongoDB,所以我select了mongoose作为我的MongoDB驱动。 “答案”文档的模式如下所示:

 'use strict'; exports = module.exports = function(app, mongoose) { var answerSchema = new mongoose.Schema({ pivot: { type: String, default: '' }, module_code: {type: String, required: true}, _year_sem: {type: String, require: true}, author: { type: String, required:true}, author_id: {type: String, required: true}, question_number: {type: String, required: true}, details: {type: String, require: true}, date: {type: Date, default: Date.now} }); answerSchema.plugin(require('./plugins/pagedFind')); answerSchema.index({ pivot: 1 }); answerSchema.index({ module_code: 1 }); answerSchema.index({ _year_sem: 1 }); answerSchema.index({ author: 1 }); answerSchema.index({ author_id: 1 }); answerSchema.index({ question_number: 1 }); answerSchema.index({ date: 1 }); answerSchema.set('autoIndex', (app.get('env') === 'development')); app.db.model('Answer', answerSchema); }; 

正如你所看到的,我没有索引“答案”文档的“细节”元素,但错误仍然存​​在。 有没有解决的办法?