Pocketbase seems to support expand
field to expand relationships when viewing or listing records. I am not sure if I am using it right but here's my setup:
This is how I tried viewing the gallery record with sections expanded in the response:
const pb = new PocketBase("http://127.0.0.1:8090/");
const data = await pb.records.getOne(
"galleries",
context.params!.id as string,
{
page: 1,
perPage: 100,
expand: "sections,sections.galleryId, sections.gallery, gallery.sections",
}
);
None of these worked. @expand field still comes empty. Am I using this correctly or is expand suppose to work on the reverse relationship. Like it would expand a gallery inside a section but not vice versa??
Pocketbase just added indirect expand in v0.8 - here's the docs on how to do it.
https://pocketbase.io/docs/expanding-relations/#indirect-expand
my expand became sections(gallery).photos(section)
- this fetched the gallery and expanded its sections and its sections photos.