title: Azure DocumentDB with MongoDB Protocol Spark integration
body: <p>I want to use DocumentDB but there is no connector for PySpark. Looks like DocumentDB also supports <a href="https://docs.microsoft.com/en-us/azure/documentdb/documentdb-protocol-mongodb" rel="nofollow noreferrer">MongoDB Protocol as mentioned here</a>, which means all existing MongoDB drivers should work. Since there is <a href="https://docs.mongodb.com/spark-connector/current/python-api/" rel="nofollow noreferrer">PySpark connector for MongoDB</a>, I wanted to try this out.</p>
  
  <pre><code>df = spark.read.format("com.mongodb.spark.sql.DefaultSource").load()
  </code></pre>
  
  <p>This throws error.</p>
  
  <pre><code>com.mongodb.MongoCommandException: Command failed with error 115: ''$sample' is not supported' on server example.documents.azure.com:10250. The full response is { "_t" : "OKMongoResponse", "ok" : 0, "code" : 115, "errmsg" : "'$sample' is not supported", "$err" : "'$sample' is not supported" }
  </code></pre>
  
  <p>It looks like DocumentDB MongoDB API doesn't support all MongoDB features, but I can't find any documentation about. Or am I missing something else?</p>