Can I modify an existing node's type?

What I want to do

Add/delete/change an existing node’s type

What I did

I have tried deleting a node’s type and adding new ones but it seems to do nothing.

{
  delete {
    <0xc> <dgraph.type> "User" .
  }
}
{
  set {
    <0xc> <dgraph.type> "OtherType" .
  }
}

I don’t know if this is even possible, but if it is I must be missing something. I can’t find anything in the docs except assigning types to a new node.

Also, if it matters I’m on Dgraph Cloud.

’ The type is just a regular predicate. A node can have 0 or more dgraph.type values for instance if it is a type implementing an interface then it would have a type value for both the interface and the implemented type. In DQL nodes can also have predicates and edges that are not of the type of the node although they can’t be queried through the GraphQL API.

That’s what I would have assumed but running the mutations above did nothing.

Check if you are using “commit now”.I’ve just tested your preposition, and it is working as expected.

First:

{
  set {
    <_:New> <dgraph.type> "User" .
  }
}
{
  result(func: uid(0x4)) {
      dgraph.type
  }
}

Second:

{
  delete {
    <0x4> <dgraph.type> "User" .
  }
}

Third:

{
  set {
    <0x4> <dgraph.type> "OtherType" .
  }
}

Finally:

{
  result(func: uid(0x4)) {
      dgraph.type
  }
}

{
  "data": {
    "result": [
      {
        "dgraph.type": [
          "OtherType"
        ]
      }
    ]
  }