We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Always
Can you please check this? Any issue with my schema or it is bug?
import Realm from "realm"; const TeacherSchema = { name: "Teacher", primaryKey: "teacherId", properties: { teacherId: { type: "int" }, teacherName: { type: "string" }, students: { type: "list", objectType: "Student" }, }, }; const StudentSchema = { name: "Student", primaryKey: "studentId", properties: { studentId: { type: "int" }, name: { type: "string" }, teacher: { type: "linkingObjects", objectType: "Teacher", property: "students", }, }, }; const realm = new Realm({ path: "./student_realm/student.realm", schema: [TeacherSchema, StudentSchema], }); const teacherData = { teacherId: 1, teacherName: "Maths Teacherr", }; realm.write(() => { realm.create("Teacher", teacherData, Realm.UpdateMode.Modified); }); realm.write(() => { const teacherResult = realm.objectForPrimaryKey("Teacher", 1); const studentData = { studentId: 1, name: "student name1", teacher: teacherResult, }; realm.create("Student", studentData, Realm.UpdateMode.Modified); }); console.log('done') realm.close();
No response
"realm": "^12.2.1",
-- select --
No
Mac, NodeJS
Which debugger for React Native: ..
The text was updated successfully, but these errors were encountered:
@saravanakumargn linkingObjects is a computed property, and you cannot use it to create the link between the object. Your second transaction should be:
linkingObjects
realm.write(() => { const teacherResult = realm.objectForPrimaryKey("Teacher", 1); const studentData = { studentId: 1, name: "student name1", }; const student = realm.create("Student", studentData, Realm.UpdateMode.Modified); teacherResult.students.push(student); });
Sorry, something went wrong.
I missed this. Thanks @kneth.
No branches or pull requests
How frequently does the bug occur?
Always
Description
Can you please check this? Any issue with my schema or it is bug?
Stacktrace & log output
No response
Can you reproduce the bug?
Always
Reproduction Steps
No response
Version
"realm": "^12.2.1",
What services are you using?
-- select --
Are you using encryption?
No
Platform OS and version(s)
Mac, NodeJS
Build environment
Which debugger for React Native: ..
Cocoapods version
No response
The text was updated successfully, but these errors were encountered: