flask-pymongo: MONGO_CONNECT ignored if MONGO_URI used
This may turn into a general discussion of how options should work in this library.
I’m using MONGO_URI
, but I want to set MONGO_CONNECT
to False
. When I call init_app
, it sees that I am using URI
and thus all other options are ignored (https://github.com/dcrosta/flask-pymongo/blob/75d9877037d509e7d8e2a5ea462ebc8e01420da1/flask_pymongo/__init__.py#L128). I have to manually add ?connect=false
into my connection uri. But my connection uri is just an environment variable and I don’t want to manipulate it.
I personally think if, when using MONGO_URI
, a config value is supplied and the corresponding uri option is not, the config value should be set instead of being thrown away.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 20 (16 by maintainers)
hi, i think : MONGO_URI = ‘mongodb://localhost/test?connect=false’ is useful
Hi all. First of all, thanks for all the feedback and ideas over the more than 2 years (!) this issue has been open. I’ve been really negligent with this project, and I apologize for that. I will try to do better.
As mentioned in #110, I’ve decided (roughly) that the route we’re going to take for an upcoming Flask-PyMongo 2.0 is to rely primarily on the URI for configuration, but allow keyword args to be passed to the
PyMongo
object for advanced configuration. This will net us behavior that’s much more similar, if not identical, to PyMongo itself.I’m going to close this issue now, since the original issue won’t be fixed in 0.x, and won’t exist (I hope!) in 2.x. I welcome feedback and discussion on #110 though – please head that way!