Related to my earlier question here, I now use Pointer to store a parent Location to my Location object.
However, now that I need the name of the parent, I’m trying to figure out if there’s a way to have the object’s custom data to be included in an includeAll / include() call.
When I do
let foundLocations = try await query.limit(20).includeAll().find()
Gives me locations + their parent locations.
However, because the Location parent object is defined as such:
struct Location: ParseObject {
// Parent
**var** parent: Pointer<Location>?
}
The parent object data that I get back is only a Pointer object as expected doing a 1 level down include():
"parent":{"__type":"Pointer","className":"Location","objectId":"UBr4yqeQ4o"}
I’m wondering if there’s a way I can include the Parent Location data to be called along side my original includeAll call so I don’t have to do additional queries per object just to get the name (field) of the parent object as I can imagine this would be costly.
Is there anyway I can create a custom extension of the Pointer object so I can save the name field as well ?
Otherwise, my current line of thinking is just add another parentName field on the Location object which seems to be the easiest.
I appreciate the help,
Jayson