How do I query my Parse Object to return all Objects in a 1:M Relation?

51 Views Asked by At

I have searched through all the other questions and answers similar to my issue. Every solution I have tried based on past answers are not working for me. It seems like there should be an easy way for me to pull the data I need, but I cannot find the correct documentation to follow.

I am using ParseSwift to store my data. I have an Object, GroupItem that stores some details about the given group, including the relation I built to my MemberItem object.

GroupItem Object

I need to grab all the MemberItem objects for a given GroupItem, which is stored in the 'anglers' Relation.

My current attempt in code is:

    do {
        try GroupItem.queryRelations("anglers", parent: groupItem!).find { result in
            switch result {
            case .success(let anglerList):
                print("Found related anglers from child: \(anglerList)")
            case .failure(let error):
                print("Error querying anglers from child: \(error)")
            }
        }
    } catch {
        print(error)
    }

I am not getting any data returned with that, though.

Thanks in advance for any help!

0

There are 0 best solutions below