JavaScript MongoDB 查询返回未定义

JavaScript MongoDB query comes back undefined

我的 server.js 文件中有以下查询:

Breed.find({$and: [
    {$or: [ { size: 's' }, { size: 'm' } ]},
    {$or: [ { exercise: 'two' }, { exercise: 'three' } ]},
    {$or: [ { training: 'two' }, { training: 'three' } ]},
    {$or: [ { grooming: 'two' }, { grooming: 'three' } ]},
    {$or: [ { catfriendly: 'two' }, { catfriendly: 'three' } ]},
    {$or: [ { protective: 'two' }, { protective: 'three' } ]},
    {$or: [ { affection: 'three' }, { affection: 'four' } ]}
    ]}, function (err, matches) {
    console.log('these are the matches: ' + matches);
    res.json(matches);
});

它返回未定义。但是我在 Mongo 终端中 运行 这个查询:

db.breeds.find({$and: [ {$or: [ { size: 's' }, { size: 'm' } ]},{$or: [ { exercise: 'two' }, { exercise: 'three' } ]}, {$or: [ { training: 'two' }, { training: 'three' } ]},{$or: [ { grooming: 'two' }, { grooming: 'three' } ]},{$or: [ { catfriendly: 'two' }, { catfriendly: 'three' } ]},{$or: [ { protective: 'two' }, { protective: 'three' } ]},{$or: [ { affection: 'three' }, { affection: 'four' } ]}]});

它 returns 4 个品种与查询相匹配。我的 server.js 文件中缺少什么导致它返回未定义?我试过控制台记录 typeof 匹配,它也说未定义。

您是否需要 server.js 中的 Breed 模型?