How do i drop data using the js library?

According to this other discussion:
Drop all data from Dgraph - Users / Dgraph - Discuss Dgraph

curl -X POST localhost:8080/alter -d '{"drop_op": "DATA"}'

is the way to drop data without schema, but what’s the equivalent command with the dgraph-js library ?

I’m assuming it’s


But this function seems to accept a number

Hi @scroobius-pip,

Thanks for your question.

Yes, it appears that setDropOp takes a number. I was looking at relevant code in dgraph-js/api_pb.d.ts at master · dgraph-io/dgraph-js · GitHub .

I tried to reproduce this and was able to delete data using op.setDropOp(dgraph.Operation.DropOp.DATA);

I have also reported this back to be included in documentation or example files.

1 Like

Added setDropOp to example, Add dropOp mutation to example by vmrajas · Pull Request #123 · dgraph-io/dgraph-js · GitHub

1 Like