gfsilva92 commented :
Is difficult to give you a reproducible example. I could do a unit test but we are using Mockito so behaviours as database retrievals are simulated.
But I’ve been doing some tests and I found out that the problem is not when getting what was inserted but on the insert. Maybe I’m doing something wrong.
I have this code to create a concept:
`Transaction txn = dgraphClient.newTransaction();
try {
String json = gson.toJson(concept);
LOGGER.info(“json to insert: \n” + json);
Mutation mu = Mutation.newBuilder().setSetJson(ByteString.copyFromUtf8(json.toString())).build();
Assigned mutate = txn.mutate(mu);
txn.commit();
String databaseId = (String) mutate.getUidsMap().values().toArray()[0];
dbNodeIds.put(concept.getId(), databaseId);
} catch (Exception e) {
LOGGER.error("An error occur when trying to create the concept " + concept.getId(), e);
} finally {
txn.discard();
}`
When trying to insert, the LOGGER.info shows the following:
2018-01-30 11:19:34 INFO DGraphConnector:74 - json to insert: {"id":"c3acc43c-c635-475d-8bed-7c3b4f2af37d","type":"concept","term":"myTerm1","jurisdiction":["jur1","jur2"],"definition":"myDef1","lastUpdate":"2018-01-30T11:19:34.150"}
After that, I went to Dgraph Ratel Dashboard and I did the following query:
{ concepts(func:eq(id, "54088896-d9e8-4cf5-90f3-9c41ff342c62"))@recurse (depth: 2){ term definition jurisdiction } }
And the query returned the following json:
{ "data": { "concepts": [ { "term": "myTerm1", "definition": "myDef1", "jurisdiction": "jur2" } ] }, "extensions": { "server_latency": { "processing_ns": 1003600 }, "txn": { "start_ts": 564, "lin_read": { "ids": { "1": 556 } } } } }
So the question is, Im I doing something wrong on the mutation to insert that content? Or is a bug from you guys?
Thanks a lot,
Gonçalo.