-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
kind/bugSomething is broken.Something is broken.status/acceptedWe accept to investigate/work on it.We accept to investigate/work on it.
Description
What version of Dgraph are you using?
latest:master
Have you tried reproducing the issue with the latest release?
Yes
What is the hardware spec (RAM, OS)?
doesn't matter
Steps to reproduce the issue (command/config used to run Dgraph).
- Run
dgraph zero - Run
dgraph alpha - Set following dgraph schema:
uuid: string @index(hash) .
author: uid .
post: [uid] .
type Post {
uuid
author
}
type Author {
uuid
post
}
- That means, a Post can have only one Author, while an Author can have multiple Posts.
- Perform following mutation:
{
"set": {
"uid": "_:Post1",
"uuid": "Post1",
"dgraph.type": "Post",
"author": {
"uid": "_:Author1",
"uuid": "Author1",
"dgraph.type": "Author"
}
}
}
- Now, perform following query, to see what mutation did:
query {
q1(func: eq(dgraph.type, "Post")) {
uid
uuid
author {
uid
uuid
}
}
}
- Result will be something like this (and that is fine):
{
"data": {
"q1": [
{
"uid": "0x2",
"uuid": "Post1",
"author": {
"uid": "0x1",
"uuid": "Author1"
}
}
]
},
"extensions": {
"server_latency": {
"parsing_ns": 68739,
"processing_ns": 2970060,
"encoding_ns": 19707,
"assign_timestamp_ns": 600806,
"total_ns": 3744032
},
"txn": {
"start_ts": 12
},
"metrics": {
"num_uids": {
"author": 1,
"dgraph.type": 0,
"post": 1,
"uid": 2,
"uuid": 2
}
}
}
}
- Let's do one more mutation, to set the author for Post1 to a new author:
{
"set": {
"uid": "0x2",
"author": {
"uid": "_:Author2",
"uuid": "Author2",
"dgraph.type": "Author"
}
}
}
- Again, perform the query to see results:
query {
q1(func: eq(dgraph.type, "Post")) {
uid
uuid
author {
uid
uuid
}
}
}
Expected behaviour and actual result.
- Expected behaviour:
{
"data": {
"q1": [
{
"uid": "0x2",
"uuid": "Post1",
"author": {
"uid": "0x3",
"uuid": "Author2"
}
}
]
},
...
}
- Actual Results:
{
"data": {
"q1": [
{
"uid": "0x2",
"uuid": "Post1",
"author": {
"uid": "0x1",
"uuid": "Author1",
"uid": "0x3",
"uuid": "Author2"
}
}
]
},
...
}
Post1 should have Author2 as its only author, but it gives both Author1 and Author2 .
Metadata
Metadata
Assignees
Labels
kind/bugSomething is broken.Something is broken.status/acceptedWe accept to investigate/work on it.We accept to investigate/work on it.