1602 / jugglingdb

Multi-database ORM for nodejs: redis, mongodb, mysql, sqlite3, postgresql, arango, in-memory...
http://1602.github.io/jugglingdb/
2.05k stars 241 forks source link

Created ability to return specific column data #408

Closed jvskelton closed 10 years ago

jvskelton commented 10 years ago

Create new core method to return specified columns in an adapter independent manner.

Example 1:

model.select({where : {name: 'bill'}, attributes: 'id'}}, callback) OR model.select({attributes: 'id'}}, callback)

returns array of ids (e.g. [ 1, 2 ])

Example 2 :

model.select({where : {name: 'bill'}, attributes: ['id']}}, callback) OR model.select({attributes: ['id']}}, callback)

returns array of objects(e.g. [{id: 1}, {id: 2}])

Example 3:

model.select({where: {address: '123'}, attributes: ['id', 'name']},callback) OR model.select({, attributes: ['id', 'name']},callback)

returns [{id: 1, name: 'bill'}, {id: 2. name: 'alice'}]

1602 commented 10 years ago

WIP commits should be squashed.