Query Then Mutate in Ratel

I just got Dgraph 1.0.4 running and was trying to do a query + mutate to reset some node values in my graph, and I could not figure out the correct way to perform this without mutating each predicate on each uid node. This used to work fine in earlier versions, but maybe I have the syntax wrong. Maybe I missed this in the docs, or this was taken away? If it was, is it coming back because it is a MUST for me.

Sorry, I’m not quite following this one. Can you explain a bit more? What were you doing before, and what are you doing now?

  es as var(func: eq(ENTITY_type, 4))
mutation {
  set {
    uid(es) <ENTITY_resolvedType> "-1"^^<xs:int> .

That used to work for me. Now I get “Mutation block no longer allowed.” in the query window, and another error in the mutate window.

Yeah, mutation variables were removed with v1.0.0 because this can be achieved using transactions. It will be a two-step process right now, you get the uids from the query and then mutate it as part of the same transaction.

How can I do that in Ratel though? Like if i need to update 1000 items at once to the same value, I cannot anymore, and doing that by hand seems to be a bit much.

There is no mechanism to do it in Ratel as you can only do mutations which are committed immediately. It should be trivial to do this using any of the clients though.

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