dresende / node-orm2

Object Relational Mapping
http://github.com/dresende/node-orm2
MIT License
3.07k stars 379 forks source link

How to pick few fields for responding ? #695

Closed kevin-lxh closed 8 years ago

kevin-lxh commented 8 years ago

I am using node-orm2 in express project. I find records contains all fields and perform some computation. Then responds with some records. It will send all fields of records to client. Is there an elegant way to filter some fields ?

the following codes don't work for me

// item is a model with fields ['id', 'title', 'modifiedDate'...]
item.id = undefined;
item.title = undefined;
res.send(item);

but client still receives all fields of item.

dxg commented 8 years ago

_.pick