I'm trying to save a Spark-DataFrame using PyMongo connecter. Following is my code, but every-time I run the code I get an error:
java.io.IOException: No FileSystem for scheme: mongodb
following is my code:
import pymongo
import pymongo_spark
pymongo_spark.activate()
from pyspark import SparkContext, SparkConf
from pyspark.sql import SQLContext
conf = SparkConf()
sc = SparkContext(conf=conf)
sqlContext=SQLContext(sc)
from pyspark.sql import SparkSession
from pyspark.sql import SparkSession
path = "hdfs://localhost:9000/home/hadoop/h_data/sales_ord_univ.csv"
df=sqlContext.read.format("com.databricks.spark.csv").option("header", "true").option("inferSchema", "true").load(path)
collections=df.collect()
df.write.format('mongodb://localhost:27017/test.sales_order_2').save()
I have a pretty naive code since Im a newbie to this, but any help towards this would be greatly appreciated. Im using Spark- 2.0.0, Python 2.7.6,MongoDB: 3.2.9