I am trying to understand and implement database structures that Moltin, an e-commerce API service, provides to my Bubble app. In their documentation, one of the models (product-modifier) allows value that can either be an array, a string or an object. See the screenshot below:
As far as I understand, I must set a data type to create a thing in Bubble. How would I implement a similar database structure in Bubble? Or any workarounds you could think of? I am new to backend/database, so any thought would be really helpful. Thanks!
Thanks for your reply. I actually didn’t mean to use their APIs - I am new to programming so I am mimicking their database structure (just to understand how to well architect databases for e-commerce apps). They have an object whose property value could either be an array of objects, a string, or an object. But in Bubble I should explicitly define a data type – can I define a name-value pair whose value’s data type can be changed?
A field for each of the different types, another field specifying which field is “in use”.
A text field with some kind of predefined formatting, with a second field, or a prefix in the text field, that tells what type the text field represents. Something like a JSON string perhaps. Bubble’s text manipulation doesn’t cover this well, but you can use javascript if all the manipulation can be done on the browser.