im出现“ E11000”错误。我的模型如下:
var TipSchema = new mg.Schema({
created: String,
title: String,
toWin: String,
stake: String,
imagecover: String,
tipcontext: String,
isFree: String,
result: String
});
var UserSchema = new mg.Schema({
username: {type: String, required: true, index: true, unique: true},
password: String,
mail: String
});
错误:“ E11000重复密钥错误索引:x.y. $ username_1 dup密钥:{: null}'}“
我的索引如下:
索引字段唯一稀疏TTL大小 {“ _id”:1}(true)(false)-7.98 KB {“ username”:1}是(否)-7.98 KB
我应该怎么做才能做到这一点?几天前,我还没有这个问题,是由“ DeprecationWarning:不推荐使用collection.ensureIndex。而是使用createIndexes”引起的。
我删除了整个数据库,并重新制作了所有内容,但没有帮助。