实验代码:
db.createCollection("student",{size:100000})
db.student.insert({sid:200800020101,name:"Wang Xin",sex:"woman",age:19,birthday:"1994-2-2",dname:"CS",class:2010})
db.student.insert({sid:200800020102,name:"Li Hua",sex:"woman",age:20,birthday:"1995-3-3",dname:"SC",class:2009})
db.student.insert({sid:200800020103,name:"ZhaoYan",sex:"man",age:21,birthday:"1996-4-4",dname:"SC",class:2009})
db.createCollection("teacher",{size:100000})
db.teacher.insert({tid:100101,name:"Zhang",sex:"F",age:44,dname:"CS"})
db.teacher.insert({tid:100102,name:"Li",sex:"M",age:45,dname:"SC"})
db.teacher.insert({tid:100103,name:"Ma",sex:"M",age:46,dname:"CS"})
db.createCollection("course",{size:100000})
db.course.insert({cid:300001,name:"DS",fcid:"",credit:2})
db.course.insert({cid:300002,name:"DB",fcid:300001,credit:2.5})
db.course.insert({cid:300003,name:"OS",fcid:300001,credit:4})
db.createCollection("student_course",{size:100000})
db.student_course.insert({sid:200800020101,cid:300001,score:91.5,tid:100101})
db.student_course.insert({sid:200800020101,cid:300002,score:92.6,tid:100102})
db.student_course.insert({sid:200800020101,cid:300003,score:93.7,tid:100103})
db.createCollection("teacher_course",{size:100000})
db.teacher_course.insert({tid:100101,cid:300001})
db.teacher_course.insert({tid:100102,cid:300002})
db.teacher_course.insert({tid:100103,cid:300003})
测试截图: