Open turing-lihaitao opened 1 year ago
It may be too late for you and you might already figured it out. In case if you are still looking for an answer...
I faced the same issue and looking into the code I saw that internally when remove operation happens it loops through the members using the index and deletes the matched members. And the group schema has @Autocompact annotation in members field, so when a child in members[] (multi value) is removed, it autocompacts the internal array. So whenever a member is removed, the autocompacts makes sure the array size is also reduced. So looping through the index will fails with index not found error
To avoid this, look for @Autocompact annotation in the groups schema for member attribute and remove it. But you need to understand that there could be nil members and you need to check for that. (Or you can invoke the Compact() method in the members property manually as required
When I create a new group and add 3 members, the content I store in the database is as follows:
Next, when I try to delete the first and second members of the group, an error occurs as follows:
Body like this:
But removing the last member can be successful
I need how to fix this, because deleting members won't delete only the last one, Thank you so much!