Query 查询
API详解
- Query.prototype.where()
参数: String 或者 ObjectReturns: Query thisUser.find({age: {$gte: 20, $lte: 66}}, callback);User.where('age').gte(21).lte(77);User.find().where({name: 'zjj'});// orUser.where('age').gte(21).lte(66).where('name', 'zjj').where('friends').slice(10).exec(callback);
- Query.prototype.equals()
参数: 对象返回: queryUser.where('age').equals(49);// 等价于User.where('age', 49);
- Query.prototype.or()
参数: array 或 conditions返回: Query// 从两个条件中至少满足一个query.or([{color: 'res'}, {status: '1'}])
- Query.prototype.nor()
参数: array 或 conditions返回: Query// 以下两个条件都不满足query.nor([{ color: 'green' }, { status: 'ok' }])
- Query.prototype.and()
参数: array 或 conditions返回: Queryquery.and([{ color: 'green' }, { status: 'ok' }])
*Query.prototype.gt()
参数: String | NumberThing.find().where('age').gt(21)// orThing.find().gt('age', 21)