I’m currently working on Padrino application with CouchDB backend. I need to have a model to store json besides some general strings. The model looks like (in pseudocode):
name: 'UniqueName',
properties: { prop1: val1, prop2: val2 }
I can’t predict how many values of which types are to be stored in properties
. Currently I use the generic model:
padrino g model MyModel name:string, properties:string
Before storing properties, I stringify json; on loading I create json from string. I feel that I’m doing wrong. Since CouchDB is ready to store json objects as is, I wonder if there is a way to tell Padrino’s model that the latter field is json for it to be stored natively? Like:
name: 'UniqueName',
properies:
- prop1: val1,
- prop2: val2
I see that I could create a separate collection and refer it by _id
from MyModel
, but at the moment I want to store it alongside it’s name
. Is it possible?