Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/468.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript .findOne函数,正在尝试具有多个参数_Javascript_Mongodb_Express_Mongoose - Fatal编程技术网

Javascript .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) }

我的.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, 
    },
});
};

你的问题似乎很好。您能显示
帐户
集合模式吗。@SaurabhAgrawal我刚刚添加了我的帐户模式您的查询似乎很好。您能显示
帐户
集合模式吗。@SaurabhAgrawal我刚刚添加了我的帐户模式