【发布时间】:2014-10-17 19:00:54
【问题描述】:
我正在从 mysql 迁移到 mongodb。现在我很困惑如何将以下模式转换为 MongoDB 或如何查询大学的课程。 mysql:
college(college_id,name)
course_college(college_id,course_id)
course(course_id,name)
mongo:
大学收藏
{
"college_id" : "1",
"name" : "Oxford ",
}
关系:
{
"college_id" : "1",
"course_id" : "1",
}, {
"college_id" : "9",
"course_id" : "67",
},
课程合集
{
"course_id" : "1",
"name" : "Master of Computer Applications ",
}
{
"course_id" : "2,
"name" : "Bachelor of Computer Applications ",
}
我需要 mongoose 查询获得大学课程才能获得这种关系。然后我转换成非关系模式。
【问题讨论】: