Set mutation returns two uids for one entity - can't tell which is correct one

Posted by shanekingston:

I’m sending a set mutation containing a single test object (in the form of JSON) and I’m getting two uids returned in the uid map. However, (as far as I can tell) only a single node has been saved in the database. The correct uid is the second entry in the map & it has the lower uid. So how can I safely determine what the uid of the node created was? Without this, I can’t use the client.

Also, response.getJson().toStringUtf8() returns nothing so I can’t verify the JSON response.

The json request string is:
{"set":[{"name":"A test person","age":"13"}]}

The code to execute the mutation is:

Mutation mu = Mutation.newBuilder()
			    .setSetJson(ByteString.copyFromUtf8(json.toString()))
			    .build();
		Response response = transaction.mutate(mu);
		response.getUidsMap().keySet()

If I copy and paste the json string into the Ratel console and run it, the JSON response only contains a single uid. So its not an issue with the JSON string, its something to do with the Java client.

shanekingston commented :

I was using 20.03.0 version of the client against the docker image “dgraph/standalone:latest”

shanekingston commented :

False alarm… I should have been sending this json:
{“name”:“A test person”,“age”:“13”}