首页 > 解决方案 > 将 Spark 数据帧写入 MongoDB 时出错

问题描述

当我尝试使用从 spark 写入 MongoDB 时

MongoSpark.save(df.write.option("collection", "hundredClub").mode("overwrite"))

MongoDB 中现有的旧数据不会被覆盖,它保持不变。在追加模式下,数据帧行在 MongoDB 中追加。

覆盖模式时出错:

couldn't find collection(hundredClub) using single partition.

它无法找到该集合

标签: mongodbdataframeapache-spark

解决方案


推荐阅读