我已经创建了一个工作正常的api,我通过post requet添加了一个用户但是当我尝试添加另一个具有不同id的用户时我得到了这个错误:
SUCCESS: {
code = 11000;
errmsg = "E11000 duplicate key error index: matchmaking.users.$id_1 dup key: { : null }";
index = 0;
op = {
"__v" = 0;
"_id" = 352523;
birthday = "1998-10-09T23:00:00.000Z";
country = denmark;
name = Frederik;
};
}
UserSchema
var userSchema = new Schema({
_id: {
type: SchemaTypes.Long,
required: true,
unique: true
},
accessToken: String,
email: String,
name: String,
birthday: Date,
country: String,
created_at: Date,
updated_at: Date
});