vapor / fluent

Vapor ORM (queries, models, and relations) for NoSQL and SQL databases
https://docs.vapor.codes/4.0/fluent/overview/
MIT License
1.3k stars 171 forks source link

Unable to specify which field to filter on within a self-relating sibling #750

Closed wibed closed 1 year ago

wibed commented 1 year ago

i try to filter on a sibling of a table pointing toward itself.

User <- Friend -> User

I fail to distinguish inbetween parent and children siblings.

similar issue: https://github.com/vapor/vapor/issues/1932 https://stackoverflow.com/questions/54157167/how-do-i-declare-a-siblings-extension-on-a-fluent-model-in-vapor-3-where-the-bas

0xTim commented 1 year ago

The docs have an example of how to use a ModelAlias for this purpose

wibed commented 1 year ago

huh, it hasn't been obvious to use a Model alias to differentiate between parent and children given a manual join.

@0xTim thanks for the hint