When saving array of pointers each pointer saved along with the attributes of the referenced object
i noticed that there was already an issue open for this and then a PR applied and fix the issue
but it turns out that somehow its still exist
#6049
this code used to save Parent Object which have list of PostCategory as Array of Pointers
// Create Parent Object with postCategories initialized as empty list and save it in the database
val ceParent = Parent().apply {
this.arName = "قسم هندسة الاتصالات"
this.enName = "CE Department"
this.postCategories = arrayListOf()
this.channelName = "ce"
}
ceParent.save()
// Create category object and link it to the previous Parent and save it in the database
val ceGeneralAnnouncementCategory = PostCategory().apply {
this.arName = ""
this.enName = "General Announcement"
this.channelName = "ceGenAnnounce"
this.parent = ceParent
}
val ceGradesCategory = PostCategory().apply {
this.arName = ""
this.enName = "Exams Grades"
this.channelName = "ceGrades"
this.parent = ceParent
}
ceGeneralAnnouncementCategory.save()
ceGradesCategory.save()
// Get the Parent object and then update it with a list of the categories that you already saved
ceParent.postCategories = arrayListOf(
ceGeneralAnnouncementCategory,
ceGradesCategory
)
ceParent.save()
[
{
"__type": "Pointer",
"className": "PostCategory",
"objectId": "OalNlXznGB"
},
{
"__type": "Pointer",
"className": "PostCategory",
"objectId": "KEmcaV5R40"
}
]
[
{
"parent": {
"postCategories": [
{
"__type": "Pointer",
"className": "PostCategory",
"objectId": "shf1jCQhst"
},
{
"parent": {
"__type": "Pointer",
"className": "Parent",
"objectId": "sP0eiMLlbM"
},
"enName": "Exams Grades",
"channelName": "itGrades",
"arName": "",
"createdAt": "2019-11-02T13:09:55.744Z",
"updatedAt": "2019-11-02T13:09:55.744Z",
"objectId": "tdijo6M8CD",
"__type": "Object",
"className": "PostCategory"
}
],
"enName": "IT Department",
"channelName": "it",
"arName": "قسم هندسة تقانة المعلومات",
"createdAt": "2019-11-02T13:09:54.359Z",
"updatedAt": "2019-11-02T13:10:10.204Z",
"objectId": "sP0eiMLlbM",
"__type": "Object",
"className": "Parent"
},
"enName": "General Announcement",
"channelName": "itGenAnnounce",
"arName": "",
"createdAt": "2019-11-02T13:09:55.160Z",
"updatedAt": "2019-11-02T13:09:55.160Z",
"objectId": "shf1jCQhst",
"__type": "Object",
"className": "PostCategory"
},
{
"parent": {
"postCategories": [
{
"parent": {
"__type": "Pointer",
"className": "Parent",
"objectId": "sP0eiMLlbM"
},
"enName": "General Announcement",
"channelName": "itGenAnnounce",
"arName": "",
"createdAt": "2019-11-02T13:09:55.160Z",
"updatedAt": "2019-11-02T13:09:55.160Z",
"objectId": "shf1jCQhst",
"__type": "Object",
"className": "PostCategory"
},
{
"__type": "Pointer",
"className": "PostCategory",
"objectId": "tdijo6M8CD"
}
],
"enName": "IT Department",
"channelName": "it",
"arName": "قسم هندسة تقانة المعلومات",
"createdAt": "2019-11-02T13:09:54.359Z",
"updatedAt": "2019-11-02T13:10:10.204Z",
"objectId": "sP0eiMLlbM",
"__type": "Object",
"className": "Parent"
},
"enName": "Exams Grades",
"channelName": "itGrades",
"arName": "",
"createdAt": "2019-11-02T13:09:55.744Z",
"updatedAt": "2019-11-02T13:09:55.744Z",
"objectId": "tdijo6M8CD",
"__type": "Object",
"className": "PostCategory"
}
]
this behaviour doesn't affect querying the Parent Object (Who has the array of pointers field)
i still able to get the array of pointers objects with include
val query = ParseQuery.getQuery(Parent::class.java)
query.whereEqualTo("objectId","uYn8FF1Qcd")
query.include(Parent::postCategories.name)
val result = query.first.postCategories
result?.forEach{
Log.d("PARENT : ","${it.channelName}")
}
maybe its problem with parse dashboard. i cleared all the records in the Parent Class and made the insertion step again and the result was as expected. but when i have made another insertion the object who saved correctly and the newly inserted object has the Array of pointers field changed to the whole object saved along with each pointer
Issue Description
When saving array of pointers each pointer saved along with the attributes of the referenced object
i noticed that there was already an issue open for this and then a PR applied and fix the issue
but it turns out that somehow its still exist
#6049
Steps to reproduce
this code used to save Parent Object which have list of PostCategory as Array of Pointers
Expected Results
saving array of pointers must be saved in this form :
Actual Outcome
but when looking to the dashboard it looks like this
Environment Setup
Note
this behaviour doesn't affect querying the Parent Object (Who has the array of pointers field)
i still able to get the array of pointers objects with
includeUPDATE
maybe its problem with parse dashboard. i cleared all the records in the Parent Class and made the insertion step again and the result was as expected. but when i have made another insertion the object who saved correctly and the newly inserted object has the Array of pointers field changed to the whole object saved along with each pointer