Unable to add a element inside an array of string after deleting it once from the array

Hi, I’m new to Dgraph and getting these issues for a couple of days, so I decided to put it here.

I have an array of titles: [string] that contains a list of titles.

I had appended a title title1 inside the titles array and after that, I deleted the same value title1 from the titles array, and when I tried to put the deleted title1 back into the array again then the title1 wasn’t there in the array or not showing up in the list.

Don’t know the cause here because there was no error during the update of the array.

The strange thing which I noticed was when I removed another title title2 from the titles array then the title1 which was not showing up before comes in the titles list again :thinking:

I have tested the same case on ratel UI and over there I didn’t find these issues. So I think it’s only occurring when the request is made via the client.

I’m using Dgraph Go client v2.2.0 here, Has anyone seen such an issue?

Hey @Prateek welcome to the Dgraph community!

Could you share a reproducible example in Go which could help us understand what you are doing better? Also please share the version of Dgraph that you are using.

Hi @pawan,
Thanks for such a quick response, I’m able to solve the issue.

It seems the issue has occurred because I have taken the instance of API.Mutation{} of “github.com/dgraph-io/dgo/v2/protos/api” package at a single place and using the same instance for doing both delete and update operation.

Now, I’m creating a new instance every time there is a delete and update operation and the issue seems to go away itself.

1 Like