我的.findOne函数似乎可以正常工作,但我想我却缺少了一些东西。它显示具有我输入的用户名的帐户,但完全忽略了“密码”字段。
exports.accountLogin = (req, res) => {
Accounts.findOne({Username: 'Test', Password: 'Password'}, (err, account) => {
if (err) return next(err);
res.send(account)
});
这是我的帐户架构
const AccountsSchema = new Schema({
Username: {
type: String,
required: true,
max: 8,
},
Password: {
type: String,
required: true,
max: 10,
},
AccountType: {
type: String,
required: true,
max: 100,
},
Email: {
type: String,
required: true,
max: 35,
},
Age: {
type: Number,
required: true,
max: 100,
},
Question1A: {
type: String,
required: true,
max: 100,
},
Question2A: {
type: String,
required: true,
max: 100,
},
Question3A: {
type: String,
required: true,
max: 100,
},
});
};