Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dgraph isn't automatically setting values ​​as list in structured mutations as list. #3788

Closed
MichelDiz opened this issue Aug 10, 2019 · 2 comments · Fixed by #4328
Closed
Assignees
Labels
area/data-loss Issues related to loss of data. area/mutations Related to mutations JSON or RDF. kind/bug Something is broken. priority/P1 Serious issue that requires eventual attention (can wait a bit) status/accepted We accept to investigate/work on it.

Comments

@MichelDiz
Copy link
Contributor

If you suspect this could be a bug, follow the template.

  • What version of Dgraph are you using?
    1.1RC

  • Have you tried reproducing the issue with latest release?
    Yes, latest RC

  • Steps to reproduce the issue (command/config used to run Dgraph).
    Add a list mutation in JSON before set the schema.

  • Expected behaviour and actual result.
    Since Dgraph automatically recognizes Types (Like [uid] this is a "list") I think it should recognize a list through a structured mutation as a list. Avoiding the user lost some data from his list. In case he forgets to define the scheme before mutating.

I didn't tested it in RDF tho. Will do.

Check reference: #3787

@MichelDiz MichelDiz added the kind/bug Something is broken. label Aug 10, 2019
@martinmr
Copy link
Contributor

Not really a bug so I've changed the tag. The reason uid is set to list is to preserve the existing behavior (since uid used to be a list by default).

@martinmr martinmr added kind/feature Something completely new we should consider. and removed kind/bug Something is broken. labels Aug 12, 2019
@campoy
Copy link
Contributor

campoy commented Sep 13, 2019

Ok, I got the issue here.

If we send a mutation like this one without setting any schema:

{
  "set": [
    {
      "name": "beethoven",
      "likes": [
        "food",
        "music"
      ]
    }
  ]
}

a query like this one:

{
  q(func: eq(name, "beethoven")) {
    name
    likes
  }
}

Will only contain one of the likes.

{
  "data": {
    "q": [
      {
        "name": "beethoven",
        "likes": "music"
      }
    ]
  },
  "extensions": { }
}

I would say this is a bug too.

@campoy campoy added kind/bug Something is broken. area/data-loss Issues related to loss of data. priority/P1 Serious issue that requires eventual attention (can wait a bit) status/accepted We accept to investigate/work on it. area/mutations Related to mutations JSON or RDF. and removed kind/feature Something completely new we should consider. labels Sep 13, 2019
@martinmr martinmr self-assigned this Nov 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/data-loss Issues related to loss of data. area/mutations Related to mutations JSON or RDF. kind/bug Something is broken. priority/P1 Serious issue that requires eventual attention (can wait a bit) status/accepted We accept to investigate/work on it.
3 participants