dresende / node-orm2

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

How to convert an object returned from raw query into an orm instance object? #554

Open yuklai opened 10 years ago

yuklai commented 10 years ago

Say I have query 'select person.* from person where ...'; I execute it with db.driver.executeQuery. With result returned from executeQuery, how can I conveniently create a Person model object (that is already defined)? I'm trying to bridge gap between code that is using ORM vs non-ORM code base.

Thanks in advance!

dxg commented 10 years ago

Does new db.models.something(props) work? If id/key attributes are present, it should be treated as an existing model instead of a new entry.