Skip to content
New issue

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

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

Closed
shanekingston opened this issue Apr 13, 2020 · 2 comments

Comments

@shanekingston
Copy link

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
Copy link
Author

shanekingston commented Apr 13, 2020

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

@shanekingston
Copy link
Author

False alarm... I should have been sending this json:
{"name":"A test person","age":"13"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant