Reading MongoDB collections into an RDD

Mathias_Peters
Contributor II

Hi, 

for a Spark job which does some custom computation, I need to access data from a MongoDB collection and access the elements as of type Document. The reason for this is, that I want to apply some custom type serialization which is already implemented and I have to reuse. 

Looking at the current mongo spark client, that client converts the documents already into rows of a dataset, which has implicit type conversion. 

Question 1: Is there a way to revert that and to get the original mongo document out of a row? 
Question 2: If 1 is not possible (likely), is there a way to load a mongodb collection directly into an RDD? I found some old code using MongoRDD which seems to have disappeared unfortunately. 

thank you