db.UserSchema = new db.Schema({
userName: {type:String,
unique:true,
required:true,index:true},
emailId: {type:String,
unique:true,
required:true,index:true},
password: {type:String,
required:true},
contactNumber: String,
region: String,
isActive:Boolean,
lastLoginDateTime:Date
});
Above is the schema I would like to put into MongoDB, but email and userName should be unique and I am unable to do that.
Aucun commentaire:
Enregistrer un commentaire