How to add json object as type for attributes in sails-mongo
Document.js
module.exports = {
attributes: {
type: {
type: 'string'
},
createdBy: {
model: 'User',
required: true
},
body: {
type: 'string'
},
comments: {
model: 'Comments'
},
metaInfo: {
type: 'json'
}
}
};
I would like to know if there is a way to write a model like the one above, so that I can add a json object to the metaInfo that contains a name-value pair.
For example: JSON: {name: 'Project', value: 'MyFirstProject'}
Is this possible with a waterline?
Thanks in advance.
+3
source to share
1 answer
I believe the comment answers your question. If you need more help, you can refer to the answers in this issue raised on the Sails Github page: JSON Array of Strings
+3
source to share