Strange 1007 Unable to save object - invalid data type for properties (DOUBLE)

Hi,

as I have an issue with the official Backendless API for iOS I have built my own based on the REST API. This works fine and gives me more control. But, I run into this strange issue, that the server rejects nested relational update requests with an error 1007. But everything looks fine.

App-ID: BAE777E3-EA86-C5EB-FF9B-669123AAEB00

When I run the request-body below with this URL: https://api.backendless.com/v1/data/AFMaterialNode/FF86DA50-2173-EADE-FF5D-F749D649B000

I get the error:

{
  "code": 1007,
  "message": "Unable to save object - invalid data type for properties - chromeReflection. You can change the property type in developer console."
}

But running the request sometimes delivers chromeReflection and in the next request its transparency. The change in no specific order. Removing chromeReflection and transparency and the request runs fine. This is really strange, as there is a third double value shininess which does not run into any errors?



{"updated":"04\/01\/48121 20:56:40 GMT+0200","__meta":"{\"relationRemovalIds\":{},\"selectedProperties\":[\"material\",\"created\",\"childNodes\",\"name\",\"___class\",\"ownerId\",\"updated\",\"objectId\"],\"relatedObjects\":{\"childNodes\":[\"0333DC6D-D8D9-EB42-FF8D-397E7379A800\",\"03BD102E-0C95-C490-FF1F-DFF6D833AE00\",\"B15D685C-4897-0EAE-FFBC-A615CCCFEE00\",\"B3819867-F161-E41E-FF75-6AC62CAC6E00\",\"BF937248-F143-28BF-FFD7-A04A59A9AD00\"]}}","childNodes":[{"updated":"04\/01\/48121 20:56:40 GMT+0200","__meta":"{\"relationRemovalIds\":{},\"selectedProperties\":[\"material\",\"created\",\"childNodes\",\"name\",\"ownerId\",\"updated\",\"objectId\"],\"relatedObjects\":{\"material\":[\"86CFD0A5-D441-1604-FF00-452EA1D72F00\"]}}","childNodes":[],"material":{"updated":"04\/01\/48121 20:56:40 GMT+0200","shininess":0.3947921194460081,"diffuseColor":"0.740392,0.778039,0.800000,1.000000","transparency":1,"specularColor":"0.922230,0.969797,1.000000,1.000000","doubleSided":false,"__meta":"{\"relationRemovalIds\":{},\"selectedProperties\":[\"shininess\",\"specularColor\",\"created\",\"transparency\",\"name\",\"doubleSided\",\"chromeReflection\",\"emissionColor\",\"ownerId\",\"diffuseColor\",\"updated\",\"objectId\"],\"relatedObjects\":{}}","created":"04\/23\/48119 20:00:00 GMT+0200","objectId":"86CFD0A5-D441-1604-FF00-452EA1D72F00","___class":"AFMaterial","emissionColor":"0.000000,0.000000,0.000000,1.000000","name":"Chrome Reflection","chromeReflection":0},"___class":"AFMaterialNode","created":"04\/23\/48119 20:00:00 GMT+0200","objectId":"0333DC6D-D8D9-EB42-FF8D-397E7379A800","name":"Chrome Pin"},{"updated":"04\/01\/48121 20:56:40 GMT+0200","__meta":"{\"relationRemovalIds\":{},\"selectedProperties\":[\"material\",\"created\",\"childNodes\",\"name\",\"ownerId\",\"updated\",\"objectId\"],\"relatedObjects\":{\"material\":[\"90CA3581-5D9F-3C6C-FF11-8E190A0F1500\"]}}","childNodes":[],"material":{"updated":"04\/01\/48121 20:56:40 GMT+0200","shininess":0.3947921194460081,"diffuseColor":"0.740392,0.778039,0.800000,1.000000","transparency":1,"specularColor":"0.922230,0.969797,1.000000,1.000000","doubleSided":false,"__meta":"{\"relationRemovalIds\":{},\"selectedProperties\":[\"shininess\",\"specularColor\",\"created\",\"transparency\",\"name\",\"doubleSided\",\"chromeReflection\",\"emissionColor\",\"ownerId\",\"diffuseColor\",\"updated\",\"objectId\"],\"relatedObjects\":{}}","created":"04\/23\/48119 20:00:00 GMT+0200","objectId":"90CA3581-5D9F-3C6C-FF11-8E190A0F1500","___class":"AFMaterial","emissionColor":"0.000000,0.000000,0.000000,1.000000","name":"Chrome Reflection","chromeReflection":0},"___class":"AFMaterialNode","created":"04\/23\/48119 20:00:00 GMT+0200","objectId":"03BD102E-0C95-C490-FF1F-DFF6D833AE00","name":"Chrome Reflection"},{"updated":"04\/01\/48121 20:56:40 GMT+0200","__meta":"{\"relationRemovalIds\":{},\"selectedProperties\":[\"material\",\"created\",\"childNodes\",\"name\",\"ownerId\",\"updated\",\"objectId\"],\"relatedObjects\":{\"material\":[\"F8498810-0EE7-BD75-FF9B-AC08DEFE1200\"]}}","childNodes":[],"material":{"updated":"04\/01\/48121 20:56:40 GMT+0200","shininess":0.02199999988079071,"diffuseColor":"0.870588,0.633255,0.172549,1.000000","transparency":1,"specularColor":"0.014931,0.009953,0.002350,1.000000","doubleSided":false,"__meta":"{\"relationRemovalIds\":{},\"selectedProperties\":[\"shininess\",\"specularColor\",\"created\",\"transparency\",\"name\",\"doubleSided\",\"chromeReflection\",\"emissionColor\",\"ownerId\",\"diffuseColor\",\"updated\",\"objectId\"],\"relatedObjects\":{}}","created":"10\/17\/48118 04:13:20 GMT+0200","objectId":"F8498810-0EE7-BD75-FF9B-AC08DEFE1200","___class":"AFMaterial","emissionColor":"0.000000,0.000000,0.000000,1.000000","name":"Test","chromeReflection":0},"___class":"AFMaterialNode","created":"10\/17\/48118 04:13:20 GMT+0200","objectId":"B15D685C-4897-0EAE-FFBC-A615CCCFEE00","name":"Test"},{"updated":"04\/01\/48121 20:56:40 GMT+0200","__meta":"{\"relationRemovalIds\":{},\"selectedProperties\":[\"material\",\"created\",\"childNodes\",\"name\",\"ownerId\",\"updated\",\"objectId\"],\"relatedObjects\":{\"material\":[\"58F969B4-7597-D6AB-FF05-8FC8D840C700\"]}}","childNodes":[],"material":{"updated":"04\/01\/48121 20:56:40 GMT+0200","shininess":0.3947921194460081,"diffuseColor":"0.740392,0.778039,0.800000,1.000000","transparency":1,"specularColor":"0.922230,0.969797,1.000000,1.000000","doubleSided":false,"__meta":"{\"relationRemovalIds\":{},\"selectedProperties\":[\"shininess\",\"specularColor\",\"created\",\"transparency\",\"name\",\"doubleSided\",\"chromeReflection\",\"emissionColor\",\"ownerId\",\"diffuseColor\",\"updated\",\"objectId\"],\"relatedObjects\":{}}","created":"04\/23\/48119 20:00:00 GMT+0200","objectId":"58F969B4-7597-D6AB-FF05-8FC8D840C700","___class":"AFMaterial","emissionColor":"0.000000,0.000000,0.000000,1.000000","name":"Chrome Reflection","chromeReflection":0},"___class":"AFMaterialNode","created":"04\/23\/48119 20:00:00 GMT+0200","objectId":"B3819867-F161-E41E-FF75-6AC62CAC6E00","name":"Chrome Pin"},{"updated":"04\/01\/48121 20:56:40 GMT+0200","__meta":"{\"relationRemovalIds\":{},\"selectedProperties\":[\"material\",\"created\",\"childNodes\",\"name\",\"ownerId\",\"updated\",\"objectId\"],\"relatedObjects\":{\"material\":[\"9C1656A0-64DD-077E-FF3F-0220E1F8EC00\"]}}","childNodes":[],"material":{"updated":"04\/01\/48121 20:56:40 GMT+0200","shininess":0.02199999988079071,"diffuseColor":"0.640000,0.670000,0.690000,1.000000","transparency":1,"specularColor":"0.010183,0.010773,0.011171,1.000000","doubleSided":false,"__meta":"{\"relationRemovalIds\":{},\"selectedProperties\":[\"shininess\",\"specularColor\",\"created\",\"transparency\",\"name\",\"doubleSided\",\"chromeReflection\",\"emissionColor\",\"ownerId\",\"diffuseColor\",\"updated\",\"objectId\"],\"relatedObjects\":{}}","created":"04\/18\/48119 11:06:40 GMT+0200","objectId":"9C1656A0-64DD-077E-FF3F-0220E1F8EC00","___class":"AFMaterial","emissionColor":"0.000000,0.000000,0.000000,1.000000","name":"Chrome","chromeReflection":0},"___class":"AFMaterialNode","created":"04\/18\/48119 11:06:40 GMT+0200","objectId":"BF937248-F143-28BF-FFD7-A04A59A9AD00","name":"Chrome"},{"childNodes":[],"material":{"chromeReflection":0.6703464673913043,"doubleSided":false,"shininess":0.6666100543478261,"___class":"AFMaterial","transparency":0.5844089673913043,"specularColor":"0.014931,0.009953,0.002350,1.000000","diffuseColor":"0.870588,0.633255,0.172549,1.000000","emissionColor":"0.000000,0.000000,0.000000,1.000000","name":"2d223"},"___class":"AFMaterialNode","name":"2d223"}],"___class":"AFMaterialNode","created":"08\/11\/48118 16:23:20 GMT+0200","objectId":"FF86DA50-2173-EADE-FF5D-F749D649B000","name":"User Presets"}

Hi Phillip,

Just to make sure I understood correctly, you need to save related entity?

Please also post here your table schema from backendless console for parent and child table.

Regards, Artur.

I have a hierarchical tree of nodes (AFMaterialNode) and to each node a material (AFMaterial) is attached. I load that tree, add a new node (and material) and update that tree, so the added nodes are saved to the server.

This is the schema for AFMaterial: https://www.dropbox.com/s/da2g8jf45wsnaja/AFMaterial.png?dl=0
And for AFMaterialNode: https://www.dropbox.com/s/91slduiei863lf3/AFMaterialNode.png?dl=0

I cannot upload images or attach files :-(.

Let’s start with the simple problem:

I cannot upload images or attach files :-(.

Do you get this icon and the link?
http://support.backendless.com/public/attachments/09e830ec793ba00b5ecfd77e75e61c4f.png</img>

Now with your query, for the request body and URL you provided, is this a POST or PUT request? Also, could you describe what the end goal for the request is? What do you expect it to do? (i.e. add/update/remove relationship or save object with relationships, etc, etc).

Mark

Hi,

I saw the buttons, but they did not work. There is a progress bar shown when adding a file/image, but it does not show any progress. I am using Safari.

I have a hierarchy of items in my application named AFMaterialNode. Those form a tree like a file system where you have folders and files. Leaf Nodes have an AFMaterial attached, in fact the application treats AFMaterialNode without a material as a folder and if a material is attached as a “file”.

What I do is loading the whole tree in one GET request by having “autoload” enabled. This works fine. In the application you can create a new material and add it to the tree in some folder. And I want that to be saved to the cloud.

Of course it would be easiest to just save the new AFMaterialNode (and attached AFMaterial), but I don’t know how to attach that to the parent node. So what I do now is just sending the whole tree (that I loaded before) back to the server, but this time new items are added to the list. I made sure the ___meta property is added as you can see in the request body.

It does not make sense to upload the whole tree just to add one node. But I don’t know how to add just one node to a “parent” relation, without uploading the whole parent.

There is actually no documentation how the relations work and how you can query implicit relations. I just don’t get my head wrapped around that.

If you just could provide some code (any language) how to add and delete an item to a one-to-many relation I would be fine.

Nevertheless what I have provided above should work I think. It may not be the smartest way, but it does not make sense to me to use Backendless if I cannot trust it to work reliably within the specifications, and as far as it’s documented the example above is exactly the same as the Phonebook example.

Today, I am running my own server with a Zend Framework 2 PHP application and a MySQL-server forming a REST API. This works very fine and very reliable and using my own code I can “shape” the results of my queries as I need them. But it takes time to develop this, too. And as I am adding user accounts I really would like to be safer on security side (which I think my users would be better of with a known BaaS instead of my hacked web application) and I also like scalability is much easier than it is with my own server infrastructure.

But, I would have added the material nodes system I am working on in one or two hours on my own server, and now I am working for a week with Backendless, and while I like it I just don’t get anything to work reliably :-(. See my other tickets. I really try ;-).

Hi Phillip,

Thank you for your explanation, it helped us to reproduce the issue.
We have assigned an internal ticket to developer, the ID is BKNDLSS-11829.

We will notify you as soon as issue would be fixed.

Best regards,
Artur.

Of course it would be easiest to just save the new AFMaterialNode (and attached AFMaterial), but I don't know how to attach that to the parent node.

Here’s pseudo-java-flavored-code which shows how to do just that:

AFMaterialNode materialNode = new AFMaterialNode();
materialNode = Backendless.Data.of( AFMaterialNode.class ).save( materialNode );


AFMaterial material = new AFMaterial();
material = Backendless.Data.of( AFMaterial.class ).findById( material-objectId );


// add node to the collection of nodes. it is OK if that collection has only one
// node, all others are not needed to just add one node.
material.addMaterialNode( materialNode );


// create a relation between material and materialNode
Backendless.Data.of( AFMaterial.class ).save( material );

There should not be “guessing” with backendless. The backend work the same way you work with objects on the client side. If you need to add to a relation, add an object to it and save. If you need to delete from a relation, get a collection, remove it from and save.

now I am working for a week with Backendless, and while I like it I just don't get anything to work reliably :-(. See my other tickets. I really try ;-).

Here are your tickets, all but this one have been resolved:
http://support.backendless.com/public/attachments/6b44e0a10a8c854225250d8abcca45a9.png</img>

Hi Phillip!

These changes already on production server (fixed error “invalid data type for properties (DOUBLE)”). Could you try again?

Hi Kate,
Should this fix be in standalone version release 04.15.2016?
Thanks in advance.