dresende / node-orm2

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

how query fild fields form two table when I use hasOne ? #661

Open hacke2 opened 8 years ago

hacke2 commented 8 years ago

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
dxg commented 8 years ago

How many queries does the above generate?