New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can not set MONGO_MAX_POOL_SIZE #77

Closed
strahe opened this Issue Jun 22, 2016 · 4 comments

Comments

Projects
None yet
4 participants
@strahe

strahe commented Jun 22, 2016

When i set MONGO_MAX_POOL_SIZE = 10 ,I get a error
"pymongo.errors.ConfigurationError: Unknown option max_pool_size"

@DJO3

This comment has been minimized.

Show comment
Hide comment
@DJO3

DJO3 Jun 22, 2016

Can you provide a sample of the code? I tried replicating the error in one of my personal applications and did not receive the error.

For reference, this is the config I used:
application = Flask(__name__)
application.config["MONGO_HOST"] = "mongoContainer"
application.config["MONGO_DBNAME"] = "setlists"
application.config['SERVER_NAME'] = 'setlist.visualizer'
application.config['MONGO_MAX_POOL_SIZE'] = 10
application.config["MONGO_CONNECT"] = False
mongo = PyMongo(application, config_prefix='MONGO')

DJO3 commented Jun 22, 2016

Can you provide a sample of the code? I tried replicating the error in one of my personal applications and did not receive the error.

For reference, this is the config I used:
application = Flask(__name__)
application.config["MONGO_HOST"] = "mongoContainer"
application.config["MONGO_DBNAME"] = "setlists"
application.config['SERVER_NAME'] = 'setlist.visualizer'
application.config['MONGO_MAX_POOL_SIZE'] = 10
application.config["MONGO_CONNECT"] = False
mongo = PyMongo(application, config_prefix='MONGO')

@strahe

This comment has been minimized.

Show comment
Hide comment
@strahe

strahe Jun 23, 2016

this is my test code:

from flask import Flask
from flask.ext.pymongo import PyMongo
app = Flask(__name__)
class Config:
    DEBUG = True
    # MongoDB
    MONGO_HOST = '127.0.0.1'
    MONGO_PORT = 27017
    MONGO_DBNAME = 'stock'
    MONGO_USERNAME = 'stock'
    MONGO_PASSWORD = 'uDZIVYP38zo6alp'
    MONGO_SOCKET_TIMEOUT_MS = 3000
    MONGO_MAX_POOL_SIZE = 10
app.config.from_object(Config)
mg = PyMongo(app)
if __name__ == '__main__':
    app.run()

this is the error:

(.venv) [strahe@strahe stock]$ python test.py 
/home/strahe/git/stock/.venv/lib/python3.5/site-packages/flask/exthook.py:71: ExtDeprecationWarning: Importing flask.ext.pymongo is deprecated, use flask_pymongo instead.
  .format(x=modname), ExtDeprecationWarning
Traceback (most recent call last):
  File "test.py", line 23, in <module>
    mg = PyMongo(app)
  File "/home/strahe/git/stock/.venv/lib/python3.5/site-packages/flask_pymongo/__init__.py", line 97, in __init__
    self.init_app(app, config_prefix)
  File "/home/strahe/git/stock/.venv/lib/python3.5/site-packages/flask_pymongo/__init__.py", line 249, in init_app
    cx = connection_cls(*args, **kwargs)
  File "/home/strahe/git/stock/.venv/lib/python3.5/site-packages/pymongo/mongo_client.py", line 342, in __init__
    for k, v in keyword_opts.items())
  File "/home/strahe/git/stock/.venv/lib/python3.5/site-packages/pymongo/mongo_client.py", line 342, in <genexpr>
    for k, v in keyword_opts.items())
  File "/home/strahe/git/stock/.venv/lib/python3.5/site-packages/pymongo/common.py", line 471, in validate
    value = validator(option, value)
  File "/home/strahe/git/stock/.venv/lib/python3.5/site-packages/pymongo/common.py", line 107, in raise_config_error
    raise ConfigurationError("Unknown option %s" % (key,))
pymongo.errors.ConfigurationError: Unknown option max_pool_size

and the version Information:

click==6.6
Flask==0.11.1
Flask-PyMongo==0.4.1
itsdangerous==0.24
Jinja2==2.8
MarkupSafe==0.23
pymongo==3.2.2
Werkzeug==0.11.10

strahe commented Jun 23, 2016

this is my test code:

from flask import Flask
from flask.ext.pymongo import PyMongo
app = Flask(__name__)
class Config:
    DEBUG = True
    # MongoDB
    MONGO_HOST = '127.0.0.1'
    MONGO_PORT = 27017
    MONGO_DBNAME = 'stock'
    MONGO_USERNAME = 'stock'
    MONGO_PASSWORD = 'uDZIVYP38zo6alp'
    MONGO_SOCKET_TIMEOUT_MS = 3000
    MONGO_MAX_POOL_SIZE = 10
app.config.from_object(Config)
mg = PyMongo(app)
if __name__ == '__main__':
    app.run()

this is the error:

(.venv) [strahe@strahe stock]$ python test.py 
/home/strahe/git/stock/.venv/lib/python3.5/site-packages/flask/exthook.py:71: ExtDeprecationWarning: Importing flask.ext.pymongo is deprecated, use flask_pymongo instead.
  .format(x=modname), ExtDeprecationWarning
Traceback (most recent call last):
  File "test.py", line 23, in <module>
    mg = PyMongo(app)
  File "/home/strahe/git/stock/.venv/lib/python3.5/site-packages/flask_pymongo/__init__.py", line 97, in __init__
    self.init_app(app, config_prefix)
  File "/home/strahe/git/stock/.venv/lib/python3.5/site-packages/flask_pymongo/__init__.py", line 249, in init_app
    cx = connection_cls(*args, **kwargs)
  File "/home/strahe/git/stock/.venv/lib/python3.5/site-packages/pymongo/mongo_client.py", line 342, in __init__
    for k, v in keyword_opts.items())
  File "/home/strahe/git/stock/.venv/lib/python3.5/site-packages/pymongo/mongo_client.py", line 342, in <genexpr>
    for k, v in keyword_opts.items())
  File "/home/strahe/git/stock/.venv/lib/python3.5/site-packages/pymongo/common.py", line 471, in validate
    value = validator(option, value)
  File "/home/strahe/git/stock/.venv/lib/python3.5/site-packages/pymongo/common.py", line 107, in raise_config_error
    raise ConfigurationError("Unknown option %s" % (key,))
pymongo.errors.ConfigurationError: Unknown option max_pool_size

and the version Information:

click==6.6
Flask==0.11.1
Flask-PyMongo==0.4.1
itsdangerous==0.24
Jinja2==2.8
MarkupSafe==0.23
pymongo==3.2.2
Werkzeug==0.11.10
@hbldh

This comment has been minimized.

Show comment
Hide comment
@hbldh

hbldh Jun 23, 2016

Contributor

I actually happened to make what I believe is a fix for this error yesterday: In PyMongo>=3.0, the parameter max_pool_size is renamed maxPoolSize, which will lead to that very problem. Made a pull request #78 with the change.

I was making some modifications to fit another issue and did this as well.

Contributor

hbldh commented Jun 23, 2016

I actually happened to make what I believe is a fix for this error yesterday: In PyMongo>=3.0, the parameter max_pool_size is renamed maxPoolSize, which will lead to that very problem. Made a pull request #78 with the change.

I was making some modifications to fit another issue and did this as well.

@dcrosta

This comment has been minimized.

Show comment
Hide comment
@dcrosta

dcrosta May 22, 2017

Owner

Closed by #78

Owner

dcrosta commented May 22, 2017

Closed by #78

@dcrosta dcrosta closed this May 22, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment