Reducing memory usage.
Connection to mongodb is now a thread var.