Correct usage of xid to upsert with Live uploader

Let me try to point this out again…

{
 test(func: has(Student.courses), first:5) {
  Student.studentId
  Student.xid # <-- Notice this
 }
}

compared with this:

<xid>: string @index(hash) . # <-- Not the same thing as
<Student.studentId>: string @index(hash) @upsert .
<Student.courses>: [uid] @count .
<Student.xid>: string @index(hash) . # <-- this here

<Course.codeId>: uid .
<Course.eventId>: int .
<Course.student>: uid .
<Course.timestamp>: datetime @index(year) .
<Course.xid>: string @index(hash) .

<CourseTcode.codeConceptId>: int @index(int) @upsert .
<CourseTcode.course>: uid .
<CourseTcode.xid>: string @index(hash) .

But in the command you are using:

dgraph live --files /root/dgraph/data --schema /root/dgraph/schema/my_schema.rdf --alpha dgraph-alpha:9080 --zero dgraph-zero:5080 --format=rdf --upsertPredicate "xid" -b 1500

In your command you use the predicate xid that is not the same as the Student.xid.

1 Like