Can I get uid information or predicate information of this node through the key whitch I defined

When I mutation it, I use “_: XXX” as the uid insert. XXX is the only value named for me. Can I get uid information or predicate information of this node through this key,thanks !

you can add another mutation like

 _:XXX  <external_id>  "XXX" .

Then you can get uid of this node by seraching <external_id>

{
   q(func: eq(<external_id>, XXX)) {
         uid
         ....
    }
}

This is a blank identifier. This means that once you mutate it and finish the transaction, this identifier if used again, will be another UID.

So, what you can do is like Zhao Lin exemplified. Or use Upsert Block to find the UID for you and mutate it.

https://docs.dgraph.io/mutations/#upsert-block
https://docs.dgraph.io/mutations/#external-ids-and-upsert-block

Cheers.

A tutorial of UPSERT like this maybe helpful

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