【发布时间】:2014-07-19 20:17:09
【问题描述】:
我以前在 SQL Server 中有两个表:
Branch(branchNo, city)
Staff(branchNo, staffNo, staffName)
在 SQL Server 上,我可以查找特定城市的所有员工,使用:
select staffName from Branch, Staff where
Branch.branchNo == Staff.branchNo AND city = 'a specific city'
现在在mongoDB中,我把两张表的内容放在一个集合中,如何使用MapReduce来获得同样的sql查询效果?
【问题讨论】:
-
您能展示一下您的 MongoDB 集合的结构吗?
-
这称为连接。 MongoDB 不做连接,而是做不同的事情。查看 MongoDB 网站上Data Modelling 上的文档部分。
-
一些行类似于(BranchNo:"B001", city:"NYC") 其他一些行类似于(BranchNo:"B001", staffNo:"s001", staffName:"John")
标签: sql sql-server mongodb mapreduce