Dose list type predicate must be set schema explicitly?

I’m using java client to mutate json data. For a new predicate with array string values, I thought it will be set as list type, but actually the type is single string. So dose the list type predicate must be set schema explicitly?

json = “{“uid”:“0x1430e”,“array_property”:[“a”, “b”, “c”]}”;
Mutation mu = Mutation.newBuilder().setSetJson(ByteString.copyFromUtf8(json.toString())).build();

I think you should define schema firstly with your dgraph-ratel. that’s so easy

Thanks for the reply. The problem is that my data and schema is dynamicly extended, I cannot know all the schema firstly…

you should set your schema when you want to insert values into list type, but if you also want to dynamicly extend your predicates, you should set schema first for those predicates which have list type

Thanks. So for list type predicate, I must set the schema first, Dgraph cannot know it according to the array data, right?

yes,for array data in json it will only keep the last data in dgraph not all this array data

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.