-
Notifications
You must be signed in to change notification settings - Fork 35
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
filtering through a HasMany relationship -> "owner.buildFindQuery is not a function" #53
Comments
I can confirm the issue. Only the "HasManyRelation" relation type seems to be affected. It works with "HasOneRelation", for example. |
I assume you are using Objection 2.0.0? This was a breaking change in major version, and I am yet to figure out how to work around it. |
This functionality was working in version 1.6.6 and broke when moving to 1.6.9. I have not isolated the commit yet but am working a solution. In the meantime, if you don't need any of the features of the later releases you might try 1.6.6 and see if that fixes your issue. |
A quick update that I have traced the issue to this commit Vincit/objection.js@1a191b5 |
This issue has been fixed in master and released with version 2.1 however there hasn't been a release to 1.6 version which is what we need here. Interestingly updating to Objection 2 and Objection-find 2 i get a different error so that's not an option. What we need is a version of objection-find, ideally 1.6.6 that has the API patch (calls .toKnexQUery instead of .build in PropertyRef). Due to the tagging in this project I don't see a clean way to provide that so we may need to encourage the library author to help us out here. @koskimas any chance you could assist? |
Further investigation reveals that objection-find@2.1 works with objection@1.6.11. I'm not entirely sure why the version change from 1 to 2 but everything appears to be working ok for me. I think in an effort to limit confusion it might be good to include the fix in 1.6.6 as I mentioned above for those developers who may have something like ^1.6.0 in their package.json files. Since Objection introduced a BC break in 1.9 this may cause additional confusion in the future. |
@steverhoades Have you tried |
I can try to provide a 1.x hotfix if that is preferred, but that would indeed require some code archeology :) |
hi,
i'm trying to do something very similar to an example in the docs:
i'm getting an error that looks like this:
i dug into the code for both
objection-find
andobjection
and one of the function signatures doesn't seem to be consistent.here's where the error is in
objection-find
:and here's the
findQuery
function as defined in objection:it looks like
findQuery
should take in aRelationOwner
as its second argument, but we're passing in the relatedRefs instead. i'm not sure how to retrieve theowner
- any help would be appreciated!here are my query parameters for context:
The text was updated successfully, but these errors were encountered: