realm / realm-graphql-service

GraphQL service for Realm Object Server
https://realm.io
Apache License 2.0
43 stars 10 forks source link

When using mutation create MODIFIED, boolean type does not update #93

Open MichaelShakke opened 5 years ago

MichaelShakke commented 5 years ago

When trying to use the mutation createProducts as a many updater, it works for all the different types (string, int, objects) except for the boolean ones, if I try:

This is the object on my DB

[
    { "id": "123", "name": "First Name", "favorite": true },
    { "id": "456", "name": "Second Name", "favorite": true }
]

This are the new values for the update

{
  "input": 
  [
    { "id": "123", "name":  "Updated First Name",  "favorite": false  },
    { "id": "456", "name":  "Updated Second Name",  "favorite": false  }
  ]
}

Mutation performed

mutation updateManyProducts($input: [ProductInput!]) {
  createProducts(input: $input, updatePolicy: MODIFIED) {
    id name favorite
  }
}

Result obtained

{
  "data": {
    "createProducts": [
      { "id": "123", "name":  "Updated First Name",  "favorite": true },
      { "id": "456", "name":  "Updated Second Name",  "favorite": true }
    ]
  }
}

The boolean value never gets updated, but the other types will always get updated. There is no permission issue, since single updates and creation works on the object.