Я регистрирую данные компании, а также пытаюсь подтвердить идентификатор электронной почты администратора этой компании на true .
Все детали отображаются на обратном вызове JSON, кроме одного т.е. verified
Вот мои данные схемы: -
var adminSchema = new mongoose.Schema({
companyName : {
type: String,
required: "Company name can't be empty.",
required: false
},
companyID: {
type: String,
},
address : {
type: String,
required: "Address can't be empty.",
},
contactDetails : {
type: String,
required: "Company contact number can't be empty.",
},
admins: {
email : {
type: String,
required: "Email can't be empty.",
unique: true
},
password: {
type: String,
required: "Password name can't be empty."
},
firstName : {
type: String,
required: "First name can't be empty."
},
lastName : {
type: String,
required: "Last name can't be empty."
},
phoneNumber : {
type: String,
required: "Reqired for further contact. Can't be empty."
},
designation : {
type: String,
required: "Designation can't be empty."
},
verified: {
type: Boolean,
default: false
},
role: String,
emailResetTokenn: String,
emailExpires: Date,
saltSecret: String,//this is user for encryption and decryption of password
users:[]
}
});
В контроллере я делаю: -
module.exports.registerAdmin = (req, res, next) =>{
var admin = new Admin();
admin.companyName = req.body.companyName;
admin.address = req.body.address;
admin.contactDetails = req.body.contactDetails;
admin.admins = {
email : req.body.email,
password: req.body.password,
firstName : req.body.firstName,
lastName : req.body.lastName,
phoneNumber : req.body.phoneNumber,
designation : req.body.designation,
role : "admin",
users: []
};
Когда я запускаю мой маршрутный API, деталь verified
не отображается как verified : false
Результат: -
{
"admins": {
"email": "losefivex@mrmail.info",
"password": "$2a$10$pgkFZAfGwHkJ2e88/d2gUeWtjVdinxGmYGx5Euh69kgH95nCIUcNa",
"firstName": "hdsdsds",
"lastName": "Ghodsdsdsh",
"phoneNumber": "4544343",
"designation": "Software Engineer",
"role": "admin",
"users": [],
"emailResetTokenn": "c833599ab72255a957007b42ca1cb8fddd566d7474b8b2b92bc08252f60184fa",
"emailExpires": "2019-05-21T18:05:46.095Z",
"saltSecret": "$2a$10$pgkFZAfGwHkJ2e88/d2gUe"
},
"_id": "5ce3e99a896e8c3ff5665702",
"companyName": "Meta",
"address": "AUS",
"contactDetails": "54534454",
"companyID": "675521",
"__v": 0
}
Почему это упущено?