implements connection events for mongo db