如何查询node-orm2中的多行?

时间:2016-01-25 15:33:49

标签: node-orm2

从手册中我理解以下说明......

Person.find({ name: "Jack" }, function (err, people) {
// finds people with name='Jack'
});

我想找两个人,“杰克”和“吉尔”。这显然是不正确的,但有点像......

Person.find({ name: "Jack" AND name: "Jill" }, function (err, people) {
// finds all people with name='Jack' and name ='Jill' 
});

2 个答案:

答案 0 :(得分:1)

Person.find({or:[{name: 'Jack'}, {name: 'Jill'}]}, function(err, res) {

});

答案 1 :(得分:0)

这应该可以正常工作:

Person.find({ name: ["Jack", "Jill"] }, function (err, people) {
    // finds all people with name='Jack' and name ='Jill' 
});