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?
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.
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.
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.
According to the tour, you should be able to delete all triples for a node with something like this:
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> * .).
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.