When I’m deleting all edges of a node, I was also somewhat expeting the “node” itself would be deleted as well.
I’m trying the following in a Ratel window.
------- SCHEMA /ALTER
person: uid @reverse .
person_name: string @index(exact,fulltext,term,trigram) .
person_address: string @index(exact) .
person_email: string @index(exact) @upsert .
------ MUTATE
{
set {
_:person1 <person> _:jondoe .
_:jondoe <person_name> "Jon Doe" .
_:jondoe <person_address> "Home of Jon Doe 42" .
_:jondoe <person_email> "jon.doe@acme.com" .
}
}
------- MUTATE
{
set {
_:person2 <person> _:janedoe .
_:janedoe <person_name> "Jane Doe" .
_:janedoe <person_address> "Home of Jane Doe 33" .
_:janedoe <person_email> "jane.doe@acme.com" .
}
}
------ QUERY
{
listPerson(func: has(person)) {
uid
person {
person_name
person_address
person_email
}
}
}
------- RESULT from above Query
{
"data": {
"listPerson": [
{
"uid": "0x4f",
"person": [
{
"person_name": "Jon Doe",
"person_address": "Home of Jon Doe 42",
"person_email": "jon.doe@acme.com"
}
]
},
{
"uid": "0x51",
"person": [
{
"person_name": "Jane Doe",
"person_address": "Home of Jane Doe 33",
"person_email": "jane.doe@acme.com"
}
]
}
]
}
----- Then I deletes the data: DELETE Person 1 /MUTATE
{
delete {
<0x51> * * .
}
}
-------- DELETE Person 2
{
delete {
<0x4f> * * .
}
}
--------- Then I repeats this query
{
listPerson(func: has(person)) {
uid
person {
person_name
person_address
person_email
}
}
}
---------- And get the following results
{
"data": {
"listPerson": [
{
"uid": "0x4f"
},
{
"uid": "0x51"
}
]
}
}
-------- However I was expecting
{
"data": {
"listPerson": []
}
}
What did I miss, where did I go wrong?
Since dGraph is not deleting the “person” node, would the consequences be that we have a lot of empty nodes?
Yes I know I could use @cascade, but the empty nodes would still be in the database?
Any suggestions, or pointers to the documentation would be most appreciated…
Cheers
Erlend