本文介绍了加入mongodb的两个集合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有两个系列,比如, 学生(StudentId,姓名,电子邮件,电话,地址,DepartmentId) 部门(DepartmentId,名称 注意:我必须将这两个系列分开。 会有关系部门之间的学生和部门系列之间。 我尝试过: 我需要一个学生集合(姓名,电子邮件,电话,地址,部门名称) 有人可以帮我这么做吗?
解决方案这看起来像家庭作业,你没有显示你尝试过的任何实际代码。 我认为这个页面会告诉你如何做你想做的事。 MongoDB - 聚合 [ ^ ]
lookup(aggregation) - MongoDB手册 [ ^ ]
I have two collection like , Student (StudentId,Name,Email,Phone,Address,DepartmentId) Department( DepartmentId,Name Note : I have to need this two collection separate. There will be a relationship between Student & Department collection by DepartmentId. What I have tried: I need a student collection with (Name,Email,Phone,Address,DepartmentName) Can anyone please help me to do this?
解决方案 This looks like homework and you don't show any actual code that you have tried. I think this page will tell you how to do what you want. MongoDB - Aggregation[^]lookup (aggregation) — MongoDB Manual[^]更多推荐
加入mongodb的两个集合
发布评论