【发布时间】:2020-03-18 17:21:15
【问题描述】:
我是 MongoDB 和 Python 的新手(使用 pymongo 3.10.1)。我可以查询一个集合,但我需要对两个集合执行连接
collection1 {
code
some other fields
}
collection2 {
code
some other fields
}
我想实现:
select * from collection2 left inner join collection1 on collection2.code = collection1.code
我只找到了使用 Python 查询 MongoDB 的基本示例。 如何用 Python 实现这一点?我可以在 Pythonn 中使用 .aggregate 和 $lookup 吗?
【问题讨论】:
标签: python-3.x mongodb pymongo-3.x