Does not work with pymongo version 3
GuusH opened this issue · comments
Hi,
I've been upgrading our MongoDB installation. MongoDB version 3 recommends or requires pymongo version 2.8 or newer (see http://docs.mongodb.org/manual/release-notes/3.0-compatibility/). Currently we're using pymongo 2.6.2 which works fine with MongoDB 2.6. If I upgrade pymongo using pip to the current version (3.0.1), this module no longer works. It tries this:
try:
from pymongo.connection import Connection
except ImportError:
Connection = None
Which fails. It raises this exception when trying to run it:
[1431011592] ERROR: [Shinken] The module mongodbretention raised an exception Cannot find the module python-pymongo. Please install both., I remove it! traceback=Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/shinken/modulesmanager.py", line 174, in get_instances
inst = module.get_instance(mod_conf)
File "/var/lib/shinken/modules/retention-mongodb/module.py", line 65, in get_instance
raise Exception('Cannot find the module python-pymongo. Please install both.')
Exception: Cannot find the module python-pymongo. Please install both.
With pymongo 3.0.1:
$ python
Python 2.7.3 (default, Dec 18 2014, 19:10:20)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pymongo.connection import Connection
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named connection
>>> import pymongo
With pymongo 2.6.2:
# python
Python 2.7.3 (default, Dec 18 2014, 19:10:20)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pymongo.connection import Connection
It looks like the preferred way of connecting to Mongo using this module is like so (which also works in older versions in 2.6.2):
>>> from pymongo import MongoClient
>>> client = MongoClient('mongodb://localhost:27017/')
I'll see if I can create a patch when I have time.
Hello,
Some modifications has been merged. Could you re-test with master version ?
Olivier
As far as I can tell, master works fine and pushing it to shinken.io would fix the issue.
Hi, I just pushed a new version (2.0.0). I invite you to test it.