node-orm2
node-orm2 copied to clipboard
how query fild fields form two table when I use hasOne ?
I had use hasOne get Pet,e.g:
Animal.hasOne('owner', Person, {reverse: 'pets'})
Person(1).getPets(function(err, pets) {
console.log(pets);
});
I want through one sql query Animal's fields, can I ?
like this sql:
SELECT person.name, animal.name FROM Person as person, Animal as animal WHERE animal.owner_id = person.id
How many queries does the above generate?