Add fields documentation

This commit is contained in:
Ritchie 2013-07-17 12:18:17 -07:00
parent 0b5e0d4252
commit 6b1ac1ab79
1 changed files with 16 additions and 4 deletions

View File

@ -284,10 +284,24 @@ Find all instances of Model, matched by query. Fields used for filter and sort s
- **order** `String` - **order** `String`
- **limit** `Number` - **limit** `Number`
- **skip** `Number` - **skip** `Number`
- **fields** `Object|Array|String`
- `['foo']` or `'foo'` - include only the foo property
- `['foo', 'bar']` - include the foo and bar properties
- `{foo: true}` - include only foo
- `{bat: false}` - include all properties, exclude bat
Find the second page of 10 users over age 21 in descending order. Find the second page of 10 users over age 21 in descending order exluding the password property.
User.find({where: {age: {gt: 21}}, order: 'age DESC', limit: 10, skip: 10}) User.find({
where: {
age: {gt: 21}},
order: 'age DESC',
limit: 10,
skip: 10,
fields: {password: false}
},
console.log
);
**Note:** See the specific connector's [docs](#connectors) for more info. **Note:** See the specific connector's [docs](#connectors) for more info.
@ -319,8 +333,6 @@ Update when record with id=data.id found, insert otherwise. **Note:** no setters
Define a static model method. Define a static model method.
User.login = function (username, password, fn) { User.login = function (username, password, fn) {
var passwordHash = hashPassword(password); var passwordHash = hashPassword(password);
this.findOne({username: username}, function (err, user) { this.findOne({username: username}, function (err, user) {