Skip to content
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

'Collection' object is not callable #4

Open
richardbaronpenman opened this issue Nov 11, 2014 · 3 comments
Open

'Collection' object is not callable #4

richardbaronpenman opened this issue Nov 11, 2014 · 3 comments

Comments

@richardbaronpenman
Copy link

>>> queue = MongoQueue(Connection('localhost').doctest_queue, consumer_id='consumer-1', timeout=300, max_attempts=3)
>>> queue.put({"foobar": 1})
TypeError: 'Collection' object is not callable. If you meant to call the 'insert' method on a 'Database' object it is failing because no such method exists.
@ghost
Copy link

ghost commented Nov 11, 2014

You should use MongoClient instead of Connection

Try this:

db = pymongo.MongoClient('localhost',27017)
queue = MongoQueue(db.local.doctest_queue,consumer_id='test',timeout=300,max_attempts=3)
queue.put({"foo":1})

@richardbaronpenman
Copy link
Author

Thanks, was using example from README.

Also I noticed you used timedelta(self.timeout). You probably want timedelta(seconds=self.timeout) because the default first argument is days.

@ktaragorn
Copy link

+1 @richardpenman I just ran into this myself.. too bad this project seems to died

ktaragorn added a commit to ktaragorn/mongoqueue that referenced this issue Oct 26, 2015
Please refer to comment on kapilt#4

If you are inclined to, you should try to make your fork the new one and maybe submit to pypi mongo_queue maybe? Too bad the original author went silent
ktaragorn added a commit to ktaragorn/mongoqueue that referenced this issue Oct 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants