Open
Description
hi,
i'm trying to do something very similar to an example in the docs:
// This checks if the relation `children` contains at least
// one person whose age is less than 10.
'children.age:lt': 10,
...
i'm getting an error that looks like this:
TypeError: owner.buildFindQuery is not a function
at HasManyRelation.findQuery (/app/backend/node_modules/objection/lib/relations/Relation.js:118:11)
at PropertyRef.buildFilter (/app/backend/node_modules/objection-find/lib/PropertyRef.js:145:28)
...
i dug into the code for both objection-find
and objection
and one of the function signatures doesn't seem to be consistent.
here's where the error is in objection-find
:
const subQuery = rel.findQuery(rel.relatedModelClass.query(), {
ownerIds: rel.ownerProp.refs(builder)
});
and here's the findQuery
function as defined in objection:
findQuery(builder, owner) {
const relatedRefs = this.relatedProp.refs(builder);
owner.buildFindQuery(builder, this, relatedRefs);
return this.applyModify(builder);
}
it looks like findQuery
should take in a RelationOwner
as its second argument, but we're passing in the relatedRefs instead. i'm not sure how to retrieve the owner
- any help would be appreciated!
here are my query parameters for context:
{
eager: '[account,assignments,users]',
'assignments.userId:eq': 1,
}
Metadata
Metadata
Assignees
Labels
No labels