mongoqueue icon indicating copy to clipboard operation
mongoqueue copied to clipboard

'Collection' object is not callable

Open richardbaronpenman opened this issue 11 years ago • 3 comments

>>> 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.

richardbaronpenman avatar Nov 11 '14 14:11 richardbaronpenman

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})

ghost avatar Nov 11 '14 16:11 ghost

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.

richardbaronpenman avatar Nov 12 '14 17:11 richardbaronpenman

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

ktaragorn avatar Oct 26 '15 03:10 ktaragorn