Delete the whole node using api.NQuad

I’m trying to delete the whole node using api.NQuad struct similar to

<uid> * * .

I tried below but it didn’t work. What am I missing?
&api.NQuad{Subject:uid, Predicate: "_STAR_ALL_", ObjectValue: &api.Value{&api.Value_DefaultVal{"_STAR_ALL"}}}

You can use this format to delete a node:

d := map[string]string{"uid": alice}
pb, err = json.Marshal(d)
if err != nil {
    log.Fatal(err)
}

mu = &api.Mutation{
    CommitNow:  true,
    DeleteJson: pb,
}

You can check for the complete example as well for deleting a node loaded in a dataset in the GoDoc :

https://godoc.org/github.com/dgraph-io/dgo#ex-Txn-Mutate-DeleteNode

you can try to delete a specific predicate, and see it works or not.

message Mutation {
    bytes set_json = 1;
    bytes delete_json = 2;
    bytes set_nquads = 3;
    bytes del_nquads = 4;

    repeated NQuad set = 10;
    repeated NQuad del = 11;
    uint64 start_ts = 13;
    bool commit_now = 14;
    bool ignore_index_conflict = 15; // this field is not parsed or used by the server anymore.
}

i try to set

bytes del_nquads = 4;

< uid > * * .

and it works

ref : ydgraph/DClient.java at master · shanghai-Jerry/ydgraph · GitHub
in line 102

Thanks @karan28aug and @shanghai-Jerry! Methods you’ve shared works but I can’t getting it working when using api.NQuad. Similar to dgo/client.go at master · dgraph-io/dgo · GitHub

i think predicate can not be _STAT_ALL, you can look more details about this:

dgo.DeleteEdges(mu, alice, “friends”, “loc”)

predicates are “friends”, “loc”

i tried to delete a specific predicate, it works. i guess it’s not supported using _STAT_ALL in predicate

&api.NQuad{ Subject: uid, Predicate: predicate, ObjectValue: &api.Value{&api.Value_DefaultVal{"_STAR_ALL"}}, })

Here Predicate: predicate, you have to give the names of predicates for which you have stored data like (name, loc, age)

Try and let me know if it works for you. You can check for this in the example as shown by @shanghai-Jerry