加入mongodb的两个集合

编程入门 行业动态 更新时间:2024-10-25 02:18:30
本文介绍了加入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的两个集合

本文发布于:2023-11-29 00:18:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1644535.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:两个   mongodb

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!