Support Topics Documentation Slack YouTube Blog

Type String or Text NOT accepting object


(Marcio Prudencio) #1

Hi Guys, I’m having Problem saving an object in the database.I can save all fields but one which contains an object {}. I can see the data in the object on console (is there) but the field remains empty on Backendless database. The field is type String, the object has < 500 chars, also changed to Text and got the same result. an empty field. Ex:

  1. sellerId: “38650E92-4C24-2B27-FF3A-B1C0B464CF00” ==> SAVED
  2. specialFullPrice: “22.50” ==> SAVED
  3. specials: {C33A2E2C-478F-44DE-FFE3-B61BDCFBAD00 {…}} ==> EMPTY
  4. userId: “87E00DDF-A1F0-748F-FF0D-DA70787D5600” ==> SAVED

(Sergey Kukurudzyak) #2

please provide your application id and full curl request or code snippet that shows the problem.


(Marcio Prudencio) #3

Hi Sergey, thanks for your prompt reply.

AppID: 9CA9AA41-6892-4A1E-FFB5-95DEAF5A4A00

Axios({
url: url,
method: ‘post’,
headers: {‘Content-Type’: ‘application/json’},
data = {
userId: ‘String’, OK
sellerId: ‘String’, OK
specials: {25781720-A1DF-07D1-FFE5-1B311D2DC800%3f33: {…}}, <= Not saving this object
specialFullPrice: ‘String’, OK
};
}).then…


(Sergey Kukurudzyak) #4

Thanks Marcio,

I am not sure how to use this example. Could you attach the file or project that I can run somehow or add a sample that I can copy and paste to the console browser or somewhere else.


(Marcio Prudencio) #5

This is my special object response. Can’t tell why is not been accepted as string…

specials: {
25781720-A1DF-07D1-FFE5-1B311D2DC800%3f33: {
ingredients: []
specialId: “25781720-A1DF-07D1-FFE5-1B311D2DC800%3f33”
specialName: “Brazilian Feijoada”
specialPrice: “25.00”
specialQuantity: 1
}
}

Here’s a printscreen: https://photos.app.goo.gl/gpRK4NPSV9oUUSDHA


(Sergey Kukurudzyak) #6

Ok, now I understand. It is not accepted as a String because it is not a string, it is an object. That is why it does not save to the specials field. I think that specials should have Data object relationship type one to many according to the name of the field. Check out hot to save relations to the object https://backendless.com/docs/rest/data_explicit_relation_list.html


(Marcio Prudencio) #7

Thanks Sergey, I’ll give a try. Regards;