Open eshell opened 10 years ago
To get only the email field from all users in the users model
User.all().only("email").run(function (error, users) {
// NOTE: the users array of objects will contain a
// skeleton of the model where only the email field has a value
// meaning users array may look like
[ {
id: [Getter/Setter], // => null
email: [Getter/Setter], // => "joe@bob.com"
password: [Getter/Setter] // => null
} ]
});
take a look at https://github.com/dresende/node-orm2/wiki/Finding-items
Hi, i'm looking to use an orm instead of doing all the sql manually as i have been. How would you select certain columns on related models?
For example.
What if you wanted all users, selecting only the email column, along with Info model selecting only 'some' and 'info' columns?