Document.js
module.exports = {
attributes: {
type: {
type: 'string'
},
createdBy: {
model: 'User',
required: true
},
body: {
type: 'string'
},
comments: {
model: 'Comments'
},
metaInfo: {
type: 'json'
}
}
};
我想知道是否有任何方法可以编写一个像上面给出的模型,这样我就可以向 metaInfo 添加一个包含名称-值对的 json 对象.
例如: JSON: { 名称:'项目',值:'MyFirstProject'}
这可以通过吃水线实现吗?
提前致谢。
最佳答案
我相信评论回答了您的问题。如果您需要任何进一步的帮助,您可以引用 Sails Github 页面中提出的这个问题的答案:JSON Array of Strings
关于json - 如何在 sails-mongo 中添加 json 对象作为属性类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27186353/