# Ratel delete node function query seems wrong

**URL:** <https://discuss.dgraph.io/t/ratel-delete-node-function-query-seems-wrong/6071>\
**Category:** Ratel\
**Created:** [March 4, 2020, 9:54am UTC](https://discuss.dgraph.io/t/ratel-delete-node-function-query-seems-wrong/6071 "2020-03-04T09:54:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![praneelrathore](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/praneelrathore/32/3684_2.png) [@praneelrathore](https://discuss.dgraph.io/u/praneelrathore)\
**Post date:** [March 4, 2020, 9:54am UTC](https://discuss.dgraph.io/t/ratel-delete-node-function-query-seems-wrong/6071/1 "2020-03-04T09:54:50Z")

</div>

Ratel delete node query looks like

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

```

I guess this is wrong as it is necessary to have the type schema after v1.1.0 as per [delete node · Issue #4057 · dgraph-io/dgraph · GitHub](https://github.com/dgraph-io/dgraph/issues/4057)

---

<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:** [March 4, 2020, 4:57pm UTC](https://discuss.dgraph.io/t/ratel-delete-node-function-query-seems-wrong/6071/2 "2020-03-04T16:57:29Z")

</div>

Not sure what you mean, can you detail what the issue is?

---

<div class="post-metadata">

**Author:** ![praneelrathore](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/praneelrathore/32/3684_2.png) [@praneelrathore](https://discuss.dgraph.io/u/praneelrathore)\
**Post date:** [March 5, 2020, 4:52am UTC](https://discuss.dgraph.io/t/ratel-delete-node-function-query-seems-wrong/6071/3 "2020-03-05T04:52:06Z")

</div>

When I try to delete a node from ratel, the query that it generates doesn’t have the type schema. Thus the delete query will not be successful as type schema is required after v1.1.0

 ![image](https://canada1.discourse-cdn.com/flex007/uploads/dgraph/original/2X/3/394a9ae754123ee414185ba86c50607cff2f57a5.png)

Running the delete mutation doesn’t actually delete the node.

---

<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:** [March 5, 2020, 6:15am UTC](https://discuss.dgraph.io/t/ratel-delete-node-function-query-seems-wrong/6071/4 "2020-03-05T06:15:06Z")

</div>

> [@praneelrathore](#):
>
> Thus the delete query will not be successful as type schema is required after v1.1.0

Yeah, so you have to add the Type to it. Types aren’t done automatically. Dgraph can’t assign a type for your node.

1 - Create your Type [Get started with Dgraph](https://docs.dgraph.io/query-language/#type-system) - It can be done in Ratel via Schema panel.

2 - Add the Type predicate. You can use the query bellow.

> #### you have to run this in the Mutation panel.

```auto
upsert {
  query {
    v as var(func: uid(0x15f91))
  }

  mutation {
    set {
      uid(v) <dgraph.type> "myType" .
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![praneelrathore](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/praneelrathore/32/3684_2.png) [@praneelrathore](https://discuss.dgraph.io/u/praneelrathore)\
**Post date:** [March 5, 2020, 6:22am UTC](https://discuss.dgraph.io/t/ratel-delete-node-function-query-seems-wrong/6071/5 "2020-03-05T06:22:06Z")

</div>

Thanks Michel. Maybe we can add an explicit prompt in the displayed query, so that users don’t get confused. Because seeing a Delete button not delete anything doesn’t seem to be right.

The generated query might look like :-  
{  
delete {  
\<0x15f91\> \<add\_type\_here\> \<add\_value\_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:** [March 5, 2020, 2:28pm UTC](https://discuss.dgraph.io/t/ratel-delete-node-function-query-seems-wrong/6071/6 "2020-03-05T14:28:42Z")

</div>

Okay, now I get it.

I have created a issue to track this

> <https://github.com/dgraph-io/ratel/issues/172>
>
> Users can be confused and frustrated when trying to delete a node via the UI. Be…cause when a node does not have the predicate "dgraph.type", it is not possible to delete it. It is necessary to add a well-defined Type to be able to do this. And Dgraph can't do it automatically.
> 
> See this user experience here https://discuss.hypermode.com/t/ratel-delete-node-function-query-seems-wrong/6071/4
> 
> If this is already implemented, please just close this.

---

<div class="post-metadata">

**Author:** ![praneelrathore](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/praneelrathore/32/3684_2.png) [@praneelrathore](https://discuss.dgraph.io/u/praneelrathore)\
**Post date:** [March 6, 2020, 6:29am UTC](https://discuss.dgraph.io/t/ratel-delete-node-function-query-seems-wrong/6071/7 "2020-03-06T06:29:38Z")

</div>

Thanks Michel. Really appreciate the quick response.
