I need to retrieve a set of records that require a somewhat complex criteria with multiple joins. I can get the records I want by doing a .query() with my own SQL. However, I am having trouble figuring out how to turn those records into actual model instances with instance methods, etc. I'm sure there's some kind of an internal method available to create a model instance from a record that's already been retrieved that I just need to map my results to, I just don't know what it is.
Some help?
You should be able to do this with Collection._model(jsObject).
I know there was talk of an effort to make this an official public api, rather than a "hidden" option using a supposedly private method.
Example:
new Pet._model({name: "fluffy"});
See this issue for details. Btw, particlebanana (Cody Stoltman) who recommended this option in that issue is the lead developer on waterline ORM. Hopefully that gives you some confidence.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With