I have a model like this:
module.exports = {
attributes: {
email: {
type: 'email',
required: true,
unique: true
},
password: {
type: 'string',
minLength: 6,
required: true
},
articles: {
collection: ‘article',
via: 'owners'
},
toJSON: function() {
var obj = this.toObject();
delete obj.password;
return obj;
}
}
}
How can I query only the ‘email’ field without deleting others in the toJSON function?
The reason for this question is, if I have like thousands of articles with embedded images and so on, it would be a waste to collect all these articles and than delete them in the toJSON function, just to show the ‘email’ field only.
So, there must be a better way to achieve that. I hope you guys can answer me this question :)
UPDATE I forgot to say that I use blueprint.js as much as possible to avoid overriding create, delete, update,... in controllers.