【发布时间】:2016-04-13 19:29:26
【问题描述】:
我是 Meteor 的新手,正在尝试找出如何最好地设计这个数据库来存储和发布数据。我认为使用这些包是有意义的:
https://github.com/aldeed/meteor-autoform
https://github.com/aldeed/meteor-simple-schema
https://github.com/iron-meteor/iron-router
我有一个要在页面上列出的课程列表的集合:
Courses = new Mongo.Collection("courses");
Courses.attachSchema(new SimpleSchema({
title: {
type: String,
label: "Title",
max: 200
},
comingSoon: {
type: boolean,
label: "Coming Soon?"
},
description: {
type: String,
label: "Course Description",
max: 200
}
}));
以及每门课程中的课程合集:
Lessons = new Mongo.Collection("lessons");
Lessons.attachSchema(new SimpleSchema({
title: {
type: String,
label: "Title",
max: 200
},
video: {
type: String,
label: "Link to video"
},
}));
并有一个管理页面来使用 autoform 包创建新课程/课程。
我的问题是如何将课程链接到与之相关的课程?我会使用 iron:router 来监听 url 中的参数并查询两个集合并创建模板布局吗?
【问题讨论】:
标签: mongodb meteor iron-router simple-schema