-
Notifications
You must be signed in to change notification settings - Fork 376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hasOne query based on referenced table #190
Comments
I think there was a question before about this, I'm not sure, I can't remember how we solved it. This is interesting, I'm going to analyse it. |
What do you think about this: // .findByOwner() assuming you defined .hasOne("owner", ...)
Animal.findByOwner({ name: "John" }, function (err, animals) {
// ...
}); |
I just added a commit with this new functionality. Please try it. |
Thank you, that what I was looking for. I now want to apply conditions to the animals. My first try was chaining it, but then in findByX the I got arround that problem adding Animal.findByOwner({ name: "John" }).find({name: "myCatName"}).run(function (err, animals) {
// ...
}); That works fine for me, but I've to mention that this could result into database errors if you have models with identical columnnames. |
The problem with models with same property names is solvable, I'm going to pull an update that should fix this. |
Thanks, that works fine. |
I have a hasOne relationship and want to query based on the referenced table.
I want to do do something like:
Any ideas how I can achieve this? In the drivers there is
opts.merge
that seems to be exactly what I am searching for, but I can not find any documentation of it.I already tried to pass
find
the options "__merge" and "extra", but ended up in a rather complex statement and failed to pass the condition.It would be great if I could just do:
The text was updated successfully, but these errors were encountered: