无法使用 pymongo 在从 Atlas Datalake 到 Atlas Cluster 的 mongodb 聚合管道上使用 $out 阶段

问题描述

所以今天我在开发过程中遇到了障碍,因为我似乎无法在网上找到任何有此问题的人。

我正在尝试使用 mongo datalake 每周将一个 CSV 文件导入我的集群,大约 1MM 记录。

为此,我建立了一个聚合管道,最后有一些转换和 $out 语句,如下所示:

{
"$out": {
    "atlas": {
        "clusterName": "Cluster","db": "source","coll": "collection"
}

根据此处的文档

https://docs.mongodb.com/datalake/reference/pipeline/out

作为最后一步。管道在 mongo 客户端等上运行良好。但是通过在 python 上这样做:

def extract_new_movers_population():
pipeline = extract_transform
res= collection.aggregate(pipeline=pipeline,allowdiskUse=True)
print(res)

我得到这个输出

pymongo.errors.OperationFailure: If an object is passed to $out it must have exactly 2 fields: 
'db' and 'coll',full error: {'operationTime': Timestamp(1612190585,1),'ok': 0.0,'errmsg': "If an object is passed to $out it must have exactly 2 fields: 
'db' and 'coll'",'code': 16994,'codeName': 'Location16994','$clusterTime': {'clusterTime': 
Timestamp(1612190585,'signature': {'hash': b')\xb6\x15\xfa\x03\x1cv\x0b\xa1\xef\xa5\x0c\x0c\x0c^\xe7\x9d/\xa2\x1f','keyId': 6922836924319137794}}}

电机驱动器变得更糟,因为驱动器吞下输出并且从不告诉

  • pymongo 是否也能做到这一点?
  • 我可以使用原始查询吗? 希望我能找到一个船长

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)