Skip to content

Instantly share code, notes, and snippets.

@danared danared/mongospark
Created Jun 24, 2016

Embed
What would you like to do?
def main(args: Array[String]): Unit = {
// Set up configurations
val sc = getSparkContext()
val sqlContext = SQLContext.getOrCreate(sc)
val readConfig = ReadConfig(Map("uri" -> "mongodb://127.0.0.1/movies.movie_ratings?readPreference=primaryPreferred"))
val writeConfig = WriteConfig(Map("uri" -> "mongodb://127.0.0.1/movies.user_recommendations"))
val userId = 0
// Load the movie rating data
val movieRatings = MongoSpark.load(sc, readConfig).toDF[UserMovieRating]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.