HI,
Does anyone have an example of code to add an “object” in a dataset and to get an object from a data base ? When I say “object” I’m talking about the Field Type “{} Object”. I don’t get actually how it works and what is exactly an Object.
Thanks
Hey there,
That Field Type of Object refers to a Javascript Object , which is used to store a structured value with multiple other types inside. A real example might be:
let Company = { name: 'My Company Name', employees: 17, services: ['Web Development','Graphic Design','Digital Marketing'] } // It has a string, a number and an array inside.
You can store something with that complex structure in your Wix Collection just like you would another type of field, and it gives the benefit of storing multiple types of related data in one column of the collection. It can get very large, and can even store other objects inside itself, like geographic Location.
In most cases though, you might not need to use it for the majority of your design requirements on your site, where you can create Fields for each item.