1

I am connecting to a cluster set up on MongoDB Atlas using the connection string given on the site.

I am running python3 and then run the import db from my module.

I get the error "pymongo.errors.InvalidURI: Invalid URI scheme: mongodb+srv"

My code looks like:

app.config["MONGOALCHEMY_DATABASE"] = "<CLUSTER NAME>"
app.config["MONGOALCHEMY_CONNECTION_STRING"] = "mongodb+srv://<REST OF URL GIVEN"

My install list looks as:

Package Version


bcrypt 3.1.7
cffi 1.12.3 Click 7.0
Flask 1.1.0
Flask-Bcrypt 0.7.1
Flask-Login 0.4.1
Flask-MongoAlchemy 0.7.2
Flask-PyMongo 0.5.2
Flask-SQLAlchemy 2.4.0
Flask-WTF 0.14.2 itsdangerous 1.1.0
Jinja2 2.10.1 MarkupSafe 1.1.1
MongoAlchemy 0.19
pip 19.1.1 pkg-resources 0.0.0
pycparser 2.19
pymongo 2.8.1
setuptools 41.0.1 six 1.12.0 SQLAlchemy 1.3.5
Werkzeug 0.15.4 wheel 0.33.4 WTForms 2.2.1

OptimusPrime
  • 777
  • 16
  • 25
  • Did you check the Atlas IP Whitelist to include your IP address? It's one of the most common problems while connecting to Atlas. – Anton Jul 07 '19 at 11:51
  • Yes it is whitelisted. – OptimusPrime Jul 07 '19 at 16:50
  • If I try connecting from the shell then I get first get an error about the port number so I append :27017 to the end and then I get the error below: – OptimusPrime Jul 07 '19 at 17:04
  • 2019-07-07T18:03:07.560+0100 Error: assertion src/mongo/client/dbclientinterface.h:231 at src/mongo/shell/mongo.js:148 exception: connect failed – OptimusPrime Jul 07 '19 at 17:04

1 Answers1

0

It seems to work now since I installed an earlier version with pip3 install Flask-MongoAlchemy==0.7.1

It now seems to connect, but I am running into other problems now.

OptimusPrime
  • 777
  • 16
  • 25