【发布时间】:2023-03-02 22:45:01
【问题描述】:
我的项目中有 2 个集合:用户和主题
在主题集合中,我有一个“createdBy”字段,用于存储用户的“_id”。
*Sample object*
{
"_id": "SNj6C5fqMntSCaXdL",
"opic": "Best Gaming Laptop",
"tags": [
"games",
"technology",
"product"
],
"createdBy": "uzsMa4fZgmrrAD9ea",
"createdAt": "2016-03-06T21:25:38.672Z"
}
在用户集合中,我为每个用户提供了“_id”、“名称”和“profile_picture_url”字段。
{
"_id": "uzsMa4fZgmrrAD9ea",
"createdAt": "2016-03-03T03:48:05.787Z",
"name": "Karan Sarin",
"profile_picture_url": "https://pbs.twimg.com/pro2_normal.jpg"
}
我正在遍历主题并显示所有主题的列表,并希望显示创建者的个人资料图片和姓名。
{{#each topics}}
<h2>{{topic_title}}<h2>
*Profile picture here* *User's name here*
{{/each}}
附:我不想将用户的图片和姓名存储在主题集合中。只是想在需要时从用户的集合中访问它们。
【问题讨论】:
标签: mongodb meteor meteor-blaze meteor-accounts meteor-helper