Javascript .findOne函数,正在尝试具有多个参数
我的.findOne函数似乎工作正常,但我想我遗漏了一些东西。它显示包含我输入的用户名的帐户,但完全忽略密码字段Javascript .findOne函数,正在尝试具有多个参数,javascript,mongodb,express,mongoose,Javascript,Mongodb,Express,Mongoose,我的.findOne函数似乎工作正常,但我想我遗漏了一些东西。它显示包含我输入的用户名的帐户,但完全忽略密码字段 exports.accountLogin = (req, res) => { Accounts.findOne({Username: 'Test', Password: 'Password'}, (err, account) => { if (err) return next(err); res.send(account) }
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,
},
});
};
你的问题似乎很好。您能显示
帐户集合模式吗。@SaurabhAgrawal我刚刚添加了我的帐户模式您的查询似乎很好。您能显示帐户集合模式吗。@SaurabhAgrawal我刚刚添加了我的帐户模式