-
Notifications
You must be signed in to change notification settings - Fork 46
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
Back-relation expand #73
Comments
You can pass your expand rule via the The string is just passed on directly to Pocketbase without further processing. Not sure what pocketbase practically does when expanding a back relation. Naively I would expect this just increases the number of query results lines but maybe it just works like a regular expansion. Keep in mind that whatever is expanded can be found in the .expand['field_name'] property of the query result (like shown in the Example). Anyhow maybe just give it a try like in the Example and see what happens. If you get an unexpected result we can have a second look! |
Not working!
I get the error:
|
Hi, i looked into this and backrelation expansion seems to work perfectly fine (just indentical to forward relation expansion) I drafted a new unit test for this to be added in def test_get_record_backrelation_expand(self, client: PocketBase, state):
backrel_field = "%s(rel)" % state.coll.id
rel = client.collection(state.coll.id).get_one(
state.chained_records[0],
{"expand": ".".join([backrel_field] * 6)},
)
for i, r in enumerate(state.chained_records):
if isinstance(rel, list):
assert len(rel) == 1
rel = rel[0]
assert rel.id == r
if i > 5:
break
rel = rel.expand[backrel_field] the unit tests shows that it is even possible to expand the backrelation 6 levels deep. This backrelation expansion is a pretty amazing feature by the way that i did not know of :-) As i mentioned previously the error you get is probably from using a (earlier) version of this library that does not yet have the fix to #65 |
…n functionality. Closes vaphes#73
Does the SDK support the back-relation expand command of pocketbase.
In the JS SDK that would be
What would be the equivalent for "alreadyVoted(post)"?
The text was updated successfully, but these errors were encountered: