汉化主题做网站效果图,长沙企业网站开发哪家专业,flash网站制作公司,东莞专业技术人才服务网班级数据库: mongodb://192.168.3.17/xxx学生数据库: mongodb://192.168.3.99/xxx (只读)使用 mongoose.createConnection 进行链接2个数据库classId 是唯一并且不会重复的。学生数据库是只读的#xff0c;并且数量非常大#xff0c;并随…班级数据库: mongodb://192.168.3.17/xxx学生数据库: mongodb://192.168.3.99/xxx (只读)使用 mongoose.createConnection 进行链接2个数据库classId 是唯一并且不会重复的。学生数据库是只读的并且数量非常大并随时可能更新。查询主要有2个问题mongodb://xxx , 两个不相同ip数据库如何关联起来分页查询传入cj查询班级只返回符合条件的班级列表、并且可能有其他同时筛选班级表的条件班级表 mongodb://192.168.3.17/xxx{ _id : 1, name : 高二(1)班, classId:a1}{ _id : 2, name : 高二(2)班, classId:a2}{ _id : 3, name : 高二(3)班, classId:a3}学生表 mongodb://192.168.3.99/xxx{ _id : x1, classId:a1, user : 张三, cj:[88,75]}{ _id : x2, classId:a2, user : 李四, cj:[88,33,99]}直接查询班级并关联学生表的列表为count:2,list: [{_id : 1,name : 高二(1)班,classId:a1,xsxx:{_id : x1,classId:a1,user : 张三,cj:[88,75]}},{_id : 2,name : 高二(2)班,classId:a2,xsxx:{_id : x2,classId:a2,user : 李四,cj:[88,33,99]}},]查询条件是 cj [33] 时count: 1,list: [{_id : 2,name : 高二(2)班,classId:a2,xsxx:{_id : x2,classId:a2,user : 李四,cj:[88,33,99]}},]我通过网络搜索的答案如下并没有帮助到我。$lookup: {from: 学生表, // 关联到学生表localField: classId, // 班级表关联的字段foreignField: classId, // 学生表关联的字as: 学生信息}我在graphql的做法是使用resolver调用查询班级表.addRelation(学生对象信息, {resolver: () 学生表.getResolver(findOne),prepareArgs: {filter: (source) {return { classId: source.classId }}},projection: { openid: true }});