Javascript client: Are variables supported in mutation blocks?

Hi,

I can’t find any doc if it is possible to execute mutation with variables in Javascript client.

Something like in this issue.

Is it supported?

Thanks

You can use transactions to query & mutate instead of variables.

Here is an example using Java.

Variables in mutation blocks are no longer supported. You will have to do query and mutation as part of a transaction as @sboorlagadda suggested. It should be easy to do so with transactions.

What about performance in case when I need to mutate 100k nodes?
In this scenario I need to fetch all nodes, extract their UID, transform it into mutation query and send it back to the server.
How about network traffic cost?

I am wondering how this would be implemented. The guides are not very helpful regarding transaction support for HTTP API. We need to support legacy IDs and fetch the corresponding dgraph uid before performing a mutation. Doing multiple requests feels somehow wrong. Any hints how to achieve this via the http client?

@selmeci I’d say give it a try and see if the throughput isn’t good enough for your use case. We do plan to support Cypher which should make it possible to do some of these operations at server side.

@namxam We have some docs for the raw HTTP client at https://docs.dgraph.io/clients/#raw-http. You’d do a query and then a mutation and commit as part of the same transaction similar to other clients. Let us know if you are stuck somewhere and I can help.

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