Facets not set via set_json for uid predicates

It seems as if I am not able to set facets on uid predicates when using the http api and using set_json to submit the following payload:

{
  "uid": "0x1",
  "seen": {
    "uid": "0x2"
  },
  "seen|tag": "example"
}

It creates the predicate, but it seems it does not add the facets. Or am I doing anything wrong?
Btw. it works fine on scalar predicates.

Ok, either docs or implementation are wrong :slight_smile:

In order to set a facet on a uid predicate, you have to nest it inside it and it is returned there as well when querying.

This works as expected:

{
  "uid": "0x1",
  "seen": {
    "uid": "0x2",
    "seen|tag": "example"
  }
}

Hey @namxam

The docs were incorrect. The syntax you have is correct. I have updated the docs for master.

https://docs.dgraph.io/master/mutations/#facets

1 Like

Yeah, I thought so and was thinking about submitting a PR. But I had a bit too much to do the last few days. Thank you for updating the docs!

1 Like

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