# Can I delete a node with delete{ S \* \* .}

**URL:** <https://discuss.dgraph.io/t/can-i-delete-a-node-with-delete-s/5728>\
**Category:** Dgraph\
**Created:** [January 2, 2020, 9:24am UTC](https://discuss.dgraph.io/t/can-i-delete-a-node-with-delete-s/5728 "2020-01-02T09:24:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![purist180](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/purist180/32/2386_2.png) [@purist180](https://discuss.dgraph.io/u/purist180)\
**Post date:** [January 2, 2020, 9:24am UTC](https://discuss.dgraph.io/t/can-i-delete-a-node-with-delete-s/5728/1 "2020-01-02T09:24:44Z")

</div>

I have trouble when I try to delete a node using delete{ S \* \* .}

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

```

When I run the commond above in Ratel, it returns “Message:Done”  
But I can still get all property the node using this uid.

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

and here’s my dgraph.type of \<0x6\>

```auto
type <人>{
    <ex_id>: String
    <身份证号>: String
    <ex_id>: String
    <性别>: String
    <地址>: String
     .....
     .....

```

---

<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:** [January 2, 2020, 4:52pm UTC](https://discuss.dgraph.io/t/can-i-delete-a-node-with-delete-s/5728/2 "2020-01-02T16:52:08Z")

</div>

The sample has the  
`_:node <dgraph.type> "人" . ` ?

---

<div class="post-metadata">

**Author:** ![purist180](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/purist180/32/2386_2.png) [@purist180](https://discuss.dgraph.io/u/purist180)\
**Post date:** [January 3, 2020, 1:18am UTC](https://discuss.dgraph.io/t/can-i-delete-a-node-with-delete-s/5728/3 "2020-01-03T01:18:17Z")

</div>

I checked the schema and data Type, problem solved, thank you again!  
but if the node have many predicates, do I have to define all of the predicates in its Type so I can delete or expand the node ?  
What should I do if I dont know what kind of predicate a node would have ?  
And how can I get all the edge or predicate a node was connected if I don’t have the TYPE?

---

<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:** [January 3, 2020, 1:52am UTC](https://discuss.dgraph.io/t/can-i-delete-a-node-with-delete-s/5728/4 "2020-01-03T01:52:59Z")

</div>

> [@purist180](#):
>
> but if the node have many predicates, do I have to define all of the predicates in its Type so I can delete or expand the node ?

yep

> [@purist180](#):
>
> What should I do if I dont know what kind of predicate a node would have ?

Well, whoever is responsible for database administration has to define these things.

There’s a new feature now, which I’m not sure could be useful. That is “`expand(myDefinedType)`”. Maybe it could be used to a sort of debug the node and know which type it belongs to. But I don’t know yet if it would be useful for that.

> [@purist180](#):
>
> And how can I get all the edge or predicate a node was connected if I don’t have the TYPE?

As I said, Admin needs to define Types. You can find out what types there are by going to the “Schema” panel in Ratel UI. And every mutation you make must contain \<dgraph.type\>. Otherwise, it won’t work.

Also, if you need a “quick migration”. You can use the Upsert Block.

```auto
upsert {
  query {
    v as var(func: has(username)) #Make sure this predicate is used only by "Persons"
  }

  mutation {
  # Adding the dgraph.type based in the given Predicate.
    set {
       uid(v) <dgraph.type> "Person" .
    }

  }
}

```

You can also do combinations in the query to do precise upserts.

Cheers.

---

<div class="post-metadata">

**Author:** ![dpk](https://avatars.discourse-cdn.com/v4/letter/d/ea5d25/32.png) [@dpk](https://discuss.dgraph.io/u/dpk)\
**Post date:** [June 1, 2020, 7:29pm UTC](https://discuss.dgraph.io/t/can-i-delete-a-node-with-delete-s/5728/5 "2020-06-01T19:29:29Z")

</div>

[According to the tour](https://dgraph.io/tour/schema/8/), you should be able to delete all triples for a node with something like this:

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

```

Is this something that was changed in more recent versions of Dgraph? I’m on v20.03.1.

For what it’s worth the node I’m trying to remove doesn’t have a type (it’s just a basic list with no index, e.g. `xyz [uid] .`) I can successfully delete nodes if I specify the predicate (`<0x123> <xyz> * .`).

---

<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:** [June 1, 2020, 7:55pm UTC](https://discuss.dgraph.io/t/can-i-delete-a-node-with-delete-s/5728/6 "2020-06-01T19:55:05Z")

</div>

> [@dpk](#):
>
> Is this something that was changed in more recent versions of Dgraph? I’m on v20.03.1.

No, you can combine bulk delete with “bulk migration” in upsert block.

---

<div class="post-metadata">

**Author:** ![dpk](https://avatars.discourse-cdn.com/v4/letter/d/ea5d25/32.png) [@dpk](https://discuss.dgraph.io/u/dpk)\
**Post date:** [June 2, 2020, 2:46pm UTC](https://discuss.dgraph.io/t/can-i-delete-a-node-with-delete-s/5728/7 "2020-06-02T14:46:37Z")

</div>

I may need to open a different topic for this as it is distinct from the case here (where there was a type). I was basing my question on the title more than the context.
