这是我的 mongoosejs 架构。我将 name unique 设置为 false,但这就是我得到的: MongoError: insertDocument::引起的::11000 E11000 重复键错误索引:testdb1.images.$name_1 dup key: { : "aaa"}强>
imageSchema = new Schema({
url: {
type: String,
unique: true,
required: true
},
category: {
type: String,
required: true
},
vote: {
type: Number,
required: true
},
name: {
type: String,
unique: false,
required: true
},
voteArray: [],
favorite: false,
tags: []
});
有什么IDE可以解决这个问题吗?建议?
最佳答案
关于MongooseJS 无法禁用唯一字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23695676/