Hello, I'm trying to create two classes (database tables) called "Student" and "Course" using the Parse platform. And the intention is to have a relationship between a student and the course. For instance, one student can have many courses. In this case, I'm creating the student "Jeff" with a course "SWEN-500"; then a course "SWEN-500"; and adding the relationship column studentCourse.
However, when I try to create another course for the same student such as
student["course"] = "SWEN-777"
, a different ID for the student (object ID) is created with SWEN-777 as a course. And two students with the same name but different ID's are created with the two courses. But I need to have the same student ID so then I can retrieve one specific student and all his courses he has taken.
func someMethod() {
let student = PFObject(className:"Student")
student["name"] = "Jeff"
student["course"] = "SWEN-500"
let course = PFObject(className:"Course")
course["course"] = "SWEN-500"
course["studentCourse"] = student
course.saveInBackground()
}
Any ideas? Thank you in advance.