【发布时间】:2020-07-29 08:35:42
【问题描述】:
我有两个模型
Account.js 和 Content.js
在content.js 我有这样的关联帐户模型
module.exports = {
attributes: {
title: { type: "string" },
description: { type: "string" },
userId: { model: "account", required: true },
categoryId: { model: "contentcategory" },
},
};
在account.js 模型文件中
我有
module.exports = {
attributes: {
fName: { type: "string" },
lName: { type: "string" },
pass: { type: "string", required: true },
email: { type: "string", required: true, isEmail: true, unique: true },
phone: { type: "number" },
walletBalance: { type: "number", defaultsTo: 0 },
},
};
在获取内容时,我会获得还包括帐户详细信息的内容列表。
{
title:"category Name",
description : "CAtegort Desc",
userId : {
id: 12552,
fName:John,
lName:Doe,
pass : "23623562356",
email:"john Doe",
phone: "124151516",
walletBalance: 234
}
}
我只想要用户的 fname 和 lname 并隐藏通行证、钱包余额等,我该怎么做呢?
【问题讨论】:
标签: node.js json model sails.js waterline