我是Meteor新手,想弄清楚如何最好地設計這個數據庫來存儲和發佈數據。我認爲這將是有意義的使用這些包:流星+ MongoDB:數據庫模式
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中的參數並查詢兩個集合並創建模板佈局?