'module' object has no attribute 'Connection' in MongoDBHandler
Opened this issue · 0 comments
DeepthiGaddam commented
When I run the code I get the above error. It is because, pymongo doesn't have Connection attribute. This will be fixed if we replace it with MongoClient as shown below
class MongoDBHandler(RequireJSONFormatter):
def __init__(self, host="localhost", db="logs", port=27017,
collection="logs"):
logging.Handler.__init__(self)
self.connection = pymongo.Connection(host, port)
has to be changed to
self.connection = pymongo.MongoClient(host, port)