用(或)和(和)同时查询数据
我需要这样做。
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) { });
尝试这个
{ "where": { "and": [ { "id": { "nin": adminIds } }, { "or": [{ firstName: {like: '%' + _query + '%'}}, { lastName: {like: '%' + _query + '%'}} ] } ] } }
从阅读: https : //docs.strongloop.com/display/public/LB/Where+filter#Wherefilter-and/or
它看起来像你需要嵌套你的or
内部和使用正则expression式而不是like
运算符。