-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Created ability to query specific colums #91
base: master
Are you sure you want to change the base?
Conversation
}); | ||
|
||
it('should query collection with given attributes array, and return array ids', function (done) { | ||
UserData.select({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be replaced with .all
This was merged to branch |
no problems, i will review anyway if you push On 3 July 2014 15:18, jvskelton [email protected] wrote:
Thanks, |
…attributes to match jugglingdb core changes
See #90.
Modified .all method to accept attributes property to select single or multiple columns.
Example 1:
model.all({where : {name: 'bill'}, attributes: 'id'}}, callback)
OR
model.all({attributes: 'id'}}, callback)
returns array of ids (e.g. [ 1, 2 ]):
Example 2 :
model.all({where : {name: 'bill'}, attributes: ['id']}}, callback)
OR
model.all({attributes: ['id']}}, callback)
returns array of objects(e.g. [{id: 1}, {id: 2}]):
Example 3:
model.all({where: {address: '123'}, attributes: ['id', 'name']},callback)
OR
model.all({, attributes: ['id', 'name']},callback)
returns [{id: 1, name: 'bill'}, {id: 2. name: 'alice'}]: