I am trying to connect mongo db from pyspark . My url starts with mongodb+srv , though it is throwing an error
java.lang.IllegalArgumentException: requirement failed: Invalid uri: 'mongodb+srv
I have used below jar files:
bson-3.4.2 , mongo-java-driver-3.4.2, mongodb-driver-core-3.4.2
Your URU should resemble the something like , "spark.mongodb.connection.uri","mongodb+srv:// USERNAME:PASSWORD@xxxxxxo.mongodb.net/somedatabasename?retryWrites=true&w=majority"
I am using spark - 2.4.3 , also can you please provide one sample code with the connector you have mentioned in the post here for reading data from mongodb using pyspark . where connection for mongodb is with srv .
URL is correct …I have used pymongo python lib and able to pull the data from mongodb . but with spark issue is coming and it is due to mainly mongodb + srv . I need correct jar and one sample code for data read from mongodb using spark .