I have this code, and I want to save the import csv file to mongodb using pyspark but I have 43 error if there another way :
from pyspark.sql import SparkSession
my_spark = SparkSession \
     .builder \
     .appName("myApp") \
     .config("spark.mongodb.input.uri", "mongodb://127.0.0.1/testtt.coll") \
     .config("spark.mongodb.output.uri", "mongodb://127.0.0.1/testtt.coll") \
     .getOrCreate()
df = spark.read.csv(path = '/home/user/Desktop/testtt.csv', header=True, inferSchema=True)
 my problem with is code:
 
df.write.format("com.mongodb.spark.sql.DefaultSource").mode("append").option("database","testtt").option("collection", "coll").save()