我需要这样做。
select *
from person
where (firstname like '%a' or lastname like "%a") and id NOT IN (1 , 2)
node.js:
BegroupdUser.find({
limit: limit,
skip: skip,
where: {
id: { nin: adminIds },
or: [{
firstName: {like: '%' + _query + '%'}
}, {
lastName: {like: '%' + _query + '%'}
}]
}
}, function (errors, users) {
});
答案 0 :(得分:1)
试试这个
{
"where": {
"and": [
{
"id": {
"nin": adminIds
}
},
{
"or": [{
firstName: {like: '%' + _query + '%'}},
{
lastName: {like: '%' + _query + '%'}}
]
}
]
}
}
答案 1 :(得分:0)
阅读本文:https://docs.strongloop.com/display/public/LB/Where+filter#Wherefilter-and/or
看起来您需要将or
嵌套在and
内并使用正则表达式而不是like
运算符。