The last issue relies on the differences between DQL and GraphQL. The other ones should be fine with the “dgraph.type” solution.
You can use Aman’s solution on schema, or add a GraphQL prefix on the dataset. GraphQL adds this prefix based on the Type on each predicate it creates. I don’t know why this isn’t documented, as I saw several users confused with this.
So, resuming, your dataset should be like
BTW, I don’t remember if the prefix needs to start with capital letters, you need to test it.
{
"User.user_id": 183,
"User.user_name": "曾..",
"User.register_time": "2020-09-07 18:13:49",
"dgraph.type": "User",
"User.browser": [
{
"dgraph.type": "Browser",
"Browser.browser_chapter|counts": 1,
"Browser.browser_chapter": {
"Chapter.chapter_id": 5,
"Chapter.chapter_name": "在...吗?",
"dgraph.type": "Chapter",
"course": {
"Course.course_id": 5,
"dgraph.type": "Course",
"Course.course_name": "金...讲"
}
}
}
]
}
And if you gonna query via DQL you have to use the prefixed predicates.
If you know what you doing, fine to use GraphQL before DQL. But if you don’t, some things can happen and you can get confused about it. The two although similar are very different things. You should learn the details before using it.
There’s no way to bulk import data in GraphQL. The Live and Bulk are the recommended ones. But, using bulk for GraphQL data, you have to understand the underneath things. Otherwise at each step you will be blocked for a long time.
If you’re not going to use GraphQL however, you shouldn’t be using GraphQL Schema at all. To make things easy.