So in javascript I have an array that looks about like this:
[{x1:0,x2:2000,y:300},{x1:50,x2:250,y:500}]
And I would like to store it in a single field in my database. I thought about either somehow making it a string and then saving it as text, but I don't really know a very efficient and "smart" way to do that. I also heard of the VARBINARY field type, but I have no idea how to write and object/array into one of those and how to read it out...
What I would really most prefer would be if it would automatically be read as an array. My MYSQL-plugin(or however that is called in js) returns my queries as arrays of objects like well:
[{id:0,bla:"text"},{id:0,bla:"text"}]
For a query in a table with the collumns id and bla.
Well say my array is stored in bla, I would like the object I get to look exactly like this right when it is returned(however if that is not possible I am fine with an alternative solution).
[{id:0,bla:[{x1:0,x2:2000,y:300},{x1:50,x2:250,y:500}]},{id:0,bla:[{x1:0,x2:2000,y:300},{x1:50,x2:250,y:500}]}]
So basically I would get an array containing two objects, which each have the properties bla and id, where bla is an array of objects with the properties x1,x2 and y.