# Delete Mutation in Ratel does not delete edges on local machine?

**URL:** <https://discuss.dgraph.io/t/delete-mutation-in-ratel-does-not-delete-edges-on-local-machine/6465>\
**Category:** Users\
**Tags:** mutation\
**Created:** [April 27, 2020, 7:43am UTC](https://discuss.dgraph.io/t/delete-mutation-in-ratel-does-not-delete-edges-on-local-machine/6465 "2020-04-27T07:43:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![M.Lau](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@M.Lau](https://discuss.dgraph.io/u/M.Lau)\
**Post date:** [April 27, 2020, 7:43am UTC](https://discuss.dgraph.io/t/delete-mutation-in-ratel-does-not-delete-edges-on-local-machine/6465/1 "2020-04-27T07:43:09Z")

</div>

I ran the following mutation in Ratel on my local machine, localhost:8080

```auto
{
    set {
       <_:test> <name> 'test'.
       <_:test_1> <name> 'test_1'.
        <_:test> <rel> <_:test_1>
    }
}

```

Assume dgraph assigns uid 0xabc11 to \_:test  
Next I ran the mutation:

```auto
{
  delete{
      <0xabc11> * * . 
   }
}

```

when I query

```auto
{
    test(func: uid(0xabc11)){
      uid
      rel {
        uid
      }
  }
}

```

I found that \_:test is still connected to \_:test\_1

what is the correct way of delete both the predicate and the edge at the same time?

Update: After further testing I notice that the delete pattern \<uid\> \* \* . is not working on my localhost. I am not sure why.

Mutation Delete:

```auto
<uid> <rel> * . Works
<uid> <name> * . Works
<uid> * * . Doesn't work

```

Update 2: So i tested the query:

```auto
{
  tree(func:uid(0xabc11))
  {
    _predicate_
    expand(_all_) {}
  }
}

```

It returns nothing… no predicates no edges

But the query:

```auto
{
  tree(func:uid(0xabc11))
  {
       name
  }
}

```

returns the name that was supposed to be deleted?

Update 3: I even tried using the JSON format “delete”:[{“uid”:“0xabc11”}] but it still has the name when queried.

I feel like I am missing something really basic here.

---

<div class="post-metadata">

**Author:** ![MichelDiz](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/micheldiz/32/11873_2.png) [@MichelDiz](https://discuss.dgraph.io/u/MichelDiz)\
**Post date:** [April 27, 2020, 10:02pm UTC](https://discuss.dgraph.io/t/delete-mutation-in-ratel-does-not-delete-edges-on-local-machine/6465/2 "2020-04-27T22:02:31Z")

</div>

You have to have the 'dgraph.type" in your dataset and also define the Type Schema.

e.g:

```auto
{
    set {
       _:test <name> "test" . 
       _:test <dgraph.type> "User". . 
       _:test_1 <name> "test_1" .
       _:test_1 <dgraph.type> "User" . 
       _:test <rel> _:test_1 .
    }
}

```

And add the Type Definition

```auto
type User {
  name
  rel
}

```

Now you are able to delete with the patterns you used.

---

<div class="post-metadata">

**Author:** ![M.Lau](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@M.Lau](https://discuss.dgraph.io/u/M.Lau)\
**Post date:** [April 28, 2020, 5:37am UTC](https://discuss.dgraph.io/t/delete-mutation-in-ratel-does-not-delete-edges-on-local-machine/6465/3 "2020-04-28T05:37:12Z")

</div>

Thanks its working now.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex007/uploads/dgraph/original/2X/2/2b38fdece2abe5814f2e51bee69d1e67fc304b0a.png) [@system](https://discuss.dgraph.io/u/system)\
**Post date:** [May 28, 2020, 5:40am UTC](https://discuss.dgraph.io/t/delete-mutation-in-ratel-does-not-delete-edges-on-local-machine/6465/4 "2020-05-28T05:40:39Z")

</div>

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