Skip to content
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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

jvskelton
Copy link
Contributor

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'}]:

});

it('should query collection with given attributes array, and return array ids', function (done) {
UserData.select({
Copy link
Contributor

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

@1602
Copy link
Contributor

1602 commented Jul 3, 2014

This was merged to branch latest. Please not that tests are still failing. Can you please fix?

@1602
Copy link
Contributor

1602 commented Jul 3, 2014

no problems, i will review anyway if you push

On 3 July 2014 15:18, jvskelton [email protected] wrote:

@anatoliychakkaev https://github.com/anatoliychakkaev just a heads up:
with the recent changes to jugglingdb core, this will also require some
modifications to adapter.all, specifically, the functionality that returns
an array of data vs array of objects (depending on the attribute
type(string vs array)


Reply to this email directly or view it on GitHub
#91 (comment)
.

Thanks,
Anatoliy Chakkaev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants