The below notebook will show you how to read and write data to MongoDB using Apache Spark. This is the library that was officially developed by MongoDB however it does require a user to set JVM parameters at cluster initialization time. Another option is the Spark-MongoDB Connector by Stratio.